SC2Mapster Forums

Development > Triggers

Moon spinning and orbiting a planet

  • 8 posts
    #1 Feb 12, 2013 at 09:19 UTC - 0 likes

    I've searched through the threads but still didn't find some proper and quick answer to that one.

    Orbit I want to make a moon (unit) orbit around another unit, except the planet is a doodad so I would like to make the unit orbit around the position of the doodad. What triggers should I use for some simple system? The orbiting would be very slow to be more realistic, probably 1 revolution per game-time hour (Faster). SOLVED

    Spin Since I have to use a Sphere model for moon, the one with grey chess texture, I want it to spin on its Z axis slowly, like Planet View and others you will see the planets spinning slowly.

    The GAx3 Mod is a whole Mod and I dont want to import other Mods just for that. Can anyone use the .Galaxy script within that mode and show me how to use it in a library or in any way, other than adding it as a Mod? I just need the Spin triggers NOT SOLVED

    Last edited Feb 12, 2013 by Eimtr
    #2 Feb 12, 2013 at 12:49 UTC - 0 likes

    If you want to go for a triggered solution you should take a look at the "Point with polar offset" function and also at the "move unit instantly" action.

    Make sure to set blend to true to make it look good.

    Here is an example:

       Local Variables
            rotating unit = Banana [26.93, 23.87] <Unit>
            rotation center = Point 001 <Point>
            current angle = (Angle from (Position of rotating unit) to rotation center) <Real>
            rotation dist = (Distance between (Position of rotating unit) and rotation center) <Real>
        Conditions
        Actions
            General - Repeat (Actions) forever
                Actions
                    Unit - Move rotating unit instantly to (rotation center offset by rotation dist towards current angle degrees) (Blend)
                    Variable - Modify current angle: + 1.0
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            current angle >= 360.0
                        Then
                            Variable - Modify current angle: - 360.0
                        Else
                    General - Wait 0.0 Game Time seconds

    Last edited Feb 12, 2013 by Mille25

    http://i55.tinypic.com/wio5t0.jpg

    Starcraft Universe lead programmer

    #3 Feb 12, 2013 at 14:58 UTC - 0 likes

    @Mille25: Go

    Thanks, works! I modified the variable to change +0.1 for very slow rotation. But for some strange reason, maybe because cliff height and what should be below is way off (my map is just space background no terrain), the moons do some very eccentric orbiting completely irregular, but on a new map with terrain it works fine, on my map though, this problem occurs.

    Orbiting
        Events
            Game - Map initialization
        Local Variables
            Moon = No Unit
            Planet = No Point
            OrbitingAngle = 0.0
            OrbitingDistance = 0.0
        Conditions
        Actions
            Variable - Set Moon[1] = Moon [158.47, 11.98]
            Variable - Set Moon[2] = Moon 2 [169.18, 110.19]
            Variable - Set Planet = (Point(256.0, 150.0))
            Variable - Set OrbitingAngle[1] = (Angle from (Position of Moon[1]) to Planet)
            Variable - Set OrbitingAngle[2] = (Angle from (Position of Moon[2]) to Planet)
            Variable - Set OrbitingDistance[1] = (Distance between (Position of Moon[1]) and Planet)
            Variable - Set OrbitingDistance[2] = (Distance between (Position of Moon[2]) and Planet)
            General - Repeat (Actions) forever
                Actions
                    General - Pick each integer from 1 to 2, and do (Actions)
                        Actions
                            Unit - Move Moon[(Picked integer)] instantly to (Planet offset by OrbitingDistance[(Picked integer)] towards OrbitingAngle[(Picked integer)] degrees) (Blend)
                            Variable - Modify OrbitingAngle[(Picked integer)]: + 0.1
                            General - If (Conditions) then do (Actions) else do (Actions)
                                If
                                    OrbitingAngle[(Picked integer)] >= 360.0
                                Then
                                    Variable - Modify OrbitingAngle[(Picked integer)]: - 360.0
                                Else
                            General - Wait 0.0 Game Time seconds
    
    Last edited Feb 12, 2013 by Eimtr
    #4 Feb 12, 2013 at 15:35 UTC - 0 likes

    Try turning the ignore terrain height state on for your moons. Im not exactly sure what the problem is though.

    #5 Feb 12, 2013 at 16:32 UTC - 0 likes

    Because my mad, the doodad is large and the Position XY I set seems to go off the map bounds, so the planets wipe the corners of the maps but now when I gave a proper X Y, all is fine, thanks.

    @Eimtr: Go

    Waiting for a way to use the galaxy script without using the whole Mod. Would be nice if one knew how to make a sphere spinning, or if one edited it to add such animation. The SphereUnnamed with chess texture.

    #6 Feb 12, 2013 at 17:27 UTC - 0 likes

    @Eimtr: Go

    You could periodically change the actor facing for the moon. This would be best done in the data editor, I think. I'll have to dig up my triggers from Xeno Crisis to see what I did for planet rotation.

    My Projects:
    Malum Ruina: SC2Mapster
    Eternal Exile: SC2Mapster
    Spine Crawler Madness: SC2Mapster
    Xeno Crisis: SC2Mapster

    #7 Feb 12, 2013 at 19:15 UTC - 0 likes

    I made a planetarum mod. its available among my files and also on the EU server. It uses records and is fairly generic. The one here on Mapster is an earlier version. The one on EU is more updated. I used the sphere model for a sun (added some shine to it) and the planet models as planets... :) Send me a pm or something if you want more info.

    #8 Feb 13, 2013 at 12:25 UTC - 0 likes

    I have a working orbiting system above. For planets I use the Planet views (not planet icons). When I have to make some custom moon, I textture select by id and just use the sphere model.So I just need a trigger or any way to make a unit spinning, including if you have that sphere with spinning animation, I said above I dont want to use whole Mods for this..

  • 8 posts

You must login to post a comment. Don't have an account? Register to get one!