Smooth PHASED rotation technique

Discussion in 'Halo and Forge Discussion' started by ExTerrestr1al, Nov 29, 2018.

  1. ExTerrestr1al

    ExTerrestr1al Spartan III
    Senior Member

    Messages:
    2,306
    Likes Received:
    2,307
    Here is something I worked with @Yumudas Beegbut to find a few months back, but I've unfortunately been busy and lazy... my apologies.

    Copy paste version cuz like I said... lazy and it's not like that many people will read it ;)

    HINT: To save scripts and for your programming efficiency, use the provided Object labels (ex. User Alpha - Zulu) to distinguish your object, and then using a separate object (script brain, joint ball, etc.) scripting it to rotate as the OBJECT in that script. If several pieces in a group, they must be welded and the axis piece the parent and the one possessing the User label OBJECT. Sometimes it is useful to add the Selection Mod - "Group: Siblings [Add]" or label them all with the same User label.

    SMOOTH PHASED (Dual-action, offset) One script

    An example of what is usually the slowest 99-100% smooth. Any faster is perfectly smooth, unless the game just hiccups for a second, which cannot be controlled. Too fast, and you will see things start to go a little nuts as the game cannot keep track of what is going on. SAME can happen if you do too many pieces rotating, period. (of any technique, but this is the most forgiving)

    Script 1
    On TImer Initial = Should have something here, this type of rotation seems to be better if started slightly after the map has fully loaded and stuff.
    Repeat .20 (sometimes .40), but must be x2 compared to following actions
    Action 1
    Rotate y=4.5
    Time=.10

    Action2
    Rotation y=4.75
    Time=.10
    Interrupt On

    This small offfset between the two actions makes the game constantly need to reevaluate how the thing is moving and send information back to the client so you see it again. Otherwise, motion is always smooth on the server side. That's the problem. You must have two values for yoru rotation that are as close to each other as possible, so that this difference is not noticeable, so you can see how going too slow, where we only have .25 increments can be a problem. Therefore, this is best for medium to fast speed stuff, and not too large of scale.

    (a few axes at once, still just 1 script)

    https://xboxdvr.com/gamer/exterrestr1al/video/61181813
     
    #1 ExTerrestr1al, Nov 29, 2018
    Last edited: Dec 10, 2018
  2. NOKYARD

    NOKYARD GrifballHub
    Cartographer Forge Critic Senior Member

    Messages:
    808
    Likes Received:
    1,220
    Can you elaborate on the "SMOOTH PHASED (Dual-action, offset) One script, (you probably know this, but instruct it to move remotely via a brain or something)" part?

    Some forgers may not be familiar with TARGET scripts. Maybe show screen shots of the scripts & Labels on both the parent and target items.
     
    ExTerrestr1al likes this.
  3. ExTerrestr1al

    ExTerrestr1al Spartan III
    Senior Member

    Messages:
    2,306
    Likes Received:
    2,307
    good call... it was originally written for Foge, who knows some stuff like this, I"m sure. Then it was just a copy pasta w/ the idea that probably no one is around to read it, but i'll go ahead and polish this up a bit ;)

    @NOKYARD I added the additional desc. above.
     
    #3 ExTerrestr1al, Dec 4, 2018
    Last edited: Dec 10, 2018
  4. DrDreidelBerg

    Messages:
    747
    Likes Received:
    1,959
    Im shocked something so damn simple was not discovered earlier, much to my surprise it works smoothly on high budget maps.
     
    ExTerrestr1al likes this.
  5. ExTerrestr1al

    ExTerrestr1al Spartan III
    Senior Member

    Messages:
    2,306
    Likes Received:
    2,307
    I know, trust me. that is my feeling as well. it's not brilliant, so much as pathetic :p there are some more operational limits if you go large-platform for players and stuff, but for asthetic pieces going med-fast it is great.

    Wait tiill you see how stupid simple the (new) smooth linear motion is...
     
  6. ExTerrestr1al

    ExTerrestr1al Spartan III
    Senior Member

    Messages:
    2,306
    Likes Received:
    2,307
    @CHa0s

    Regarding your questions...

    The hint above refers to adding a label to at least the parent object and then welding it. Then, if you use a different object (Brain) to tell that labelled object to move, you're golden.

    Your old build did not work because you literally instructed each independent piece to rotate "This", and you want "Label Add = User Label x"

    But, very large contraptions like 256x floors may not work well with this method, unfortunately. The tiny jitters will be noticeable at larger scales... :( depends on your exact speed etc.
     
  7. CHa0s

    CHa0s Spartan III
    Wiki Contributor Senior Member

    Messages:
    131
    Likes Received:
    84
    Thanks, man, I think I know what you are saying, hopping on to dink around with it now. I'm totally ok with it jittering, I just want it to work! I have ideas.

    Side note but relevant to this thread, when I went to the video link above, which blew my mind on it's own (I don't even know what you made that spinny thing with?), xboxdvr autoplayed to the next vid and I couldn't believe how beautiful these wheels are. I had to double check and make sure I was looking at a video of Halo 5 Forge!

    https://xboxdvr.com/gamer/exterrestr1al/video/60767816

    I saw that and I was like, "Maybe this guy knows a little something about rotating groups in forge..." heh heh.
     
    ExTerrestr1al likes this.
  8. CHa0s

    CHa0s Spartan III
    Wiki Contributor Senior Member

    Messages:
    131
    Likes Received:
    84
    Is there a way to stop the timer and start it back up again?

    Edit: I think I know a way, have a script that makes labeled object "Wait" some time into the rotating, either by timer or message recieved, then use a different script with a timer that has a delay that doesn't start until you want the group/object to start rotating again.

    But still wondering if there's a way to do this with a message recieved, since unfortunately we can't repeat action unless using the timer :/
     
    ExTerrestr1al likes this.
  9. ExTerrestr1al

    ExTerrestr1al Spartan III
    Senior Member

    Messages:
    2,306
    Likes Received:
    2,307
    Thanks, that is a gearset designed by @Omni42 and I was trying to help with. the video you linked shows the upper limits of grouped rotation. on his full map, even this #1 technique described in this thread starts to fall apart with that many items moving simultaneously. His map unfortunately, was just asking too much of the game.

    It was when trying to fix his gears that I and @Yumudas Beegbut found this new nugget of info.
     
  10. ExTerrestr1al

    ExTerrestr1al Spartan III
    Senior Member

    Messages:
    2,306
    Likes Received:
    2,307
    this is where you get a little more advanced so you have more control over the setup...

    The easiest thing to do is probably to make the script brain that is instructing the rotating group, to despawn when you want the rotation turned off. You'll also need to mark the Rotate scripts with "Always On = Off".

    How you despawn the brain and switch the behavior on/off at that point, is up to you!
     
    CHa0s likes this.
  11. CHa0s

    CHa0s Spartan III
    Wiki Contributor Senior Member

    Messages:
    131
    Likes Received:
    84

    I tried to test this, and weird things happen. The blocks don't move in unison and get skewed (and MAP OPTIONS - RESET OBJECTS POSITIONS... doesn't :/ borked). Script brain despawns like I ask it to, but the blocks continue rotating anyway even after it despawns. On top of that, script brain never respawns. Maybe I'm missing something?

    Here's the script I set:

    Script Brain
    Script 1

    WHEN... Condition - Timer:Check, Initial 3/Repeat 6
    DO... Action 1 - Despawn (Always Runs: Off)
    Script 2
    WHEN... Condition - Timer:Check, Initial 6/Repeat 6
    DO... Action 1 - Spawn (Always Runs: Off)
    Script 3 (Your smooth moves script, including settings Label [add] user:alpha in OBJECTS)
    WHEN... Condition - Timer: Check, Initial 1/Repeat .20
    DO... Action 1 Rotate: Offset, Yaw 4.5, Time .10 | Action 2 Rotate: Offset, Yaw 4.75, Time .10


    8x8x2 blocks (5 in + shape, center block is parent, group welded)
    LABELS setting user:alpha)


    Thanks for helping, let me know if I can return the favor somehow.
     
    ExTerrestr1al likes this.
  12. ExTerrestr1al

    ExTerrestr1al Spartan III
    Senior Member

    Messages:
    2,306
    Likes Received:
    2,307
    ahh, that's right, I Forgot that despawning the script will keep it going. what it does, is it disconnects your client from the server and the piece just continues on what was the trajectory it had before, but severe wobbles creep in.

    now that I t hink of it, I've never wired something rotating to have an on/off switch using this technique. I'll try to think of something...

    Perhaps you should also force the rotating object to instantly despawn/respawn (action 1 & 2 on a script) to make it go b ack to original position?

    *Your piece is not respawning because you want Always On checked for that because it won't be able to run while it is despawned, thus not complete the action to Spawn it later.

    **This game seems to have a way of modelling what we tell it to do in scripting, and then figure out what will happen later. It's weird. If you do not specifically tell something to respawn, Reset Map will not ever bring it back in that forge session. So, it is a good rule of thumb to always script something to have a respawn trigger so that the game knows its okay to bring it back by other means like Reset etc... (Very weird behavior of the game)

    ***When working in Forge with groups of moving/rotating objects, always be extremely careful touching that group with your Hand/Mouse unless the scripts that will instruct it to move, are totally off and will not run while you are holding it. It breaks the group in forge permanently if you save. Then, you'll have no choice but to rebuild that group. Fun stuff, I know. But these are the additional headaches that you have to work through/around to do the advanced stuff ;)

    A good procedure is...

    1.Turn off Scripting (Map)
    2.Reset Map
    3.Touch Group, make changes (SAME APPLIES TO BRAINS CONTROLLING GROUP)
    4.Turn Scripting on
     
    #12 ExTerrestr1al, Dec 13, 2018
    Last edited: Dec 14, 2018
  13. ExTerrestr1al

    ExTerrestr1al Spartan III
    Senior Member

    Messages:
    2,306
    Likes Received:
    2,307
  14. CHa0s

    CHa0s Spartan III
    Wiki Contributor Senior Member

    Messages:
    131
    Likes Received:
    84
    @ExTerrestr1al thanks, I'll check it out and study it! RE: group scripts breaking, I'm in the habit of saving a group as a prefab after I code it, before I turn it on. That way I can just pull another one in if it nerfs up!
     
    ExTerrestr1al likes this.
  15. CHa0s

    CHa0s Spartan III
    Wiki Contributor Senior Member

    Messages:
    131
    Likes Received:
    84
    @ExTerrestr1al Clever how you worked around the "script continuing to run when brain despawns" by telling it to move 0 when it despawns. Never would have thought of that.

    I needed the rotating to be off when the match started, as my group has to be lined up with a doorway. I worked around it by telling the group and script head to despawn at match start. Then, I have the group spawn in delayed. I swapped the On/Off from your version, so "On" spawns my brain, thus turning on rotation.
    https://www.halowaypoint.com/en-us/...d 2CHa0s_eddec25d-1054-46a0-a273-10f330b648eb


    I think this is going to work! Thanks so much. I had it working, but not using your smooth phase rotation technique. This will ramp up the quality of my finished project!
     
    #15 CHa0s, Dec 15, 2018
    Last edited: Dec 15, 2018
    ExTerrestr1al likes this.
  16. ExTerrestr1al

    ExTerrestr1al Spartan III
    Senior Member

    Messages:
    2,306
    Likes Received:
    2,307
    Glad to hear it is coming together.

    I forgot to mention, related to the groups getting mangled, that if you haven't touched it while in forge, when it loads up the next time it is in its original saved position. Sometimes, because we are F'ing with it in Forge (that's where the f comes from) it can get messed up, but in an actual customs match it would load and probably stay together as intended.

    So, like if you haved reset map and it doesn't really revert to where it's supposed to. Just don't grab the group at all unless you need to. In that case, replacing w/ prefab or regrouping and correcting it will be needed. But if not, just leave it alone and it will load as it originally was.
     
    CHa0s likes this.

Share This Page