"Semi-fixed" Object Physics: Tutorial

Discussion in 'Halo and Forge Discussion' started by Fythic, Oct 24, 2016.

  1. Fythic

    Fythic Legendary

    Messages:
    15
    Likes Received:
    5
    ((posted on r/forge too: https://www.reddit.com/r/forge/comments/5974ki/semifixed_object_physics_tutorial/))

    I discovered something really interesting yesterday and I wanted to share it with everyone in the forge community. I have no idea if it's been discovered before, but I can't seem to find anything through youtube and google searches.

    ~ANYWAY~

    Here's a quick text-tutorial on how to do this. Relevant game-capture of it: http://xboxdvr.com/gamer/fythicc/video/22768549


    Do you remember those floating [platforms in epitaph in halo 3]( Remember how they move depending on how you walk on it or apply force on it? You can make those in H5 forge with two simple scripts on an object/group. I'm going to call it "Semi-fixed" object physics, because it stays in place but can still be moved around. There's only one current downside to this, and it is that scripting can sometimes break on objects, so it can randomly stop working at times. Let's hope the next update fixes that. Let's get right to the procedure.


    Also, here's a quick game capture of me actually creating it, to supplement the written procedure: http://xboxdvr.com/gamer/fythicc/video/22769106


    1. Place an object that is capable of normal physics (welded groups work too!) and put it in the resting position you want it to be in.

    2. Set it to normal physics.

    3. Add two scripts to it.

    3a. --> Script 1;

    On timer:
    Initial Delay: 0.0s;
    Repeat time: 0.2s;

    Action:

    Position/Rotation Reset:
    Velocity Reset: On ((IT DEFAULTS TO ON, BUT IT ISNT ACTUALLY ON. FLICK ON THEN OFF);
    Time: <Your own time here> (the lower the time, the faster it will come back to default position. Do not test with anything lower than 1 second, it may glitch out);

    3b. --> Script 2;

    SAME AS SCRIPT 1. EXACT SAME. CHANGE INITIAL DELAY TO 0.1s;

    4. After finished that, set the object physics to normal, then drop the object, and it will fall for about a tenth of a second, then float back into position and stay there.

    P.S. It's glitchy and breaks due to the script breaking from the update.

    And Voila! That's it, that's how you can get semi fixed physics on your object. It barely moves from explosions and generally any entity that tends to do damage. Player movement, vehicle movement, and object movement can move these semi fixed pieces quite nicely.

    edit: bolded text, stability is increased with this change.
     
    #1 Fythic, Oct 24, 2016
    Last edited: Oct 24, 2016
    N3gat1veZer0 likes this.
  2. Agent Zero85

    Agent Zero85 Legendary
    Wiki Contributor Senior Member

    Messages:
    400
    Likes Received:
    435
    For what i see here, you simply have 2 position reset scripts going. The point of such a script is the pieces will constantly go back to position. Because it is on normal it will move fall, but the first script keeps it up. The second script is supporting the first in resetting its position. The glitchiness is not the game's scripting breaking, thats you doing weird **** with it (lol). In this situation there's technically something wrong with scripting. So if they "fixed it" your machine will break.
    Timers are in fact broken, they are unreliable, but the glitchiness is not because of that, it's because the local xbox and server argue over the object's position, and thats why it rubberbands like that.
     
    Yumudas Beegbut and Fythic like this.
  3. Fythic

    Fythic Legendary

    Messages:
    15
    Likes Received:
    5
    You are correct, but what I was specifically talking about is the fact that the scripts just stop working as a whole at random times. I think this has to do with the timer bug. The rubberbanding was unintentional as well, but that is a much smaller issue that imposes no real impedance to it's actual purpose, if that makes sense.
    Correct me if I'm wrong, because I may be overlooking something. Thanks for the clarification, though. :)
     
    Yumudas Beegbut likes this.
  4. Fythic

    Fythic Legendary

    Messages:
    15
    Likes Received:
    5
    Hm, with more testing, it turns out when the scripts are offset by 0.1 seconds, it runs much nicer. I remember testing it before and it didn't work when offset, maybe i'm wrong. I may have tested it with velocity:reset off. Either way, the script seems to barely, if not, never breaks anymore. Thanks Agent Zero85 for the insight :)
     
  5. Fythic

    Fythic Legendary

    Messages:
    15
    Likes Received:
    5
    Spoke too soon. It's still happening. It's either what you said or scripts breaking via the update. Let's hope it's the 2nd one.
     
  6. Yumudas Beegbut

    Yumudas Beegbut Legendary
    Wiki Contributor Senior Member

    Messages:
    393
    Likes Received:
    352
    Yeah, Velocity: Reset = On should stabilize it some. The wobblyness gets worse when the local Xbox thinks objects have some velocity, so it should work better the more often the server and Xbox both agree on the position and velocity.

    You can also try making them agree more often by using velocity scripts that are frequently triggered. I'm actually not sure what happens when velocity scripts trigger while a reset script is active. I'd guess that they're ignored.

    // Any object. {switch} power channel turns it on/off, {tick} power channel toggles every game tick 1/60s
    (Multi Min:2 Pwr{switch}=On Pwr{switch}=On Pwr{tick}=Tog) <Power{tick}=Toggle>

    // Platform object {Physics: Normal}
    (Multi Min:1 Pwr{tick}=Tog) <Velocity 0/0/0>

    // OR do one that wobbles to force a position update every other game tick
    (Power{tick}=On) <Velocity 0/0/0.5>
    (Power{tick}=Off) <Velocity 0/0/-0.5>

    And then throw in the occasional position reset to keep it roughly in place (keep what you have, but use just one that fires every second or so).

    NOTES: Collisions still affect normal-physics objects that have a velocity 0/0/0 script firing every tick, but the object immediately stops moving. Sometimes I've had the local Xbox apply gravity to objects with velocity 0/0/0 scripts running & it keeps falling until it collides with something and then it seems to reset to where the server says it is. I should've done a thread about this months ago.

    One last thing. If you use rotation 0/0/0 scripts, velocity scripts or gravity slides will move the object while they're active, even if the Physics is set to Phased or Fixed. Collisions won't affect fixed or phased objects.
     

Share This Page