Moving, Launching & Throwing Players

Discussion in 'Tutorials & Resources' started by 【EmNudge】, Feb 9, 2017.

  1. 【EmNudge】

    【EmNudge】 L4: Comfortable Member

    Messages:
    182
    Positive Ratings:
    37
    I'm gonna talk about 3 brush based entities that allow you to throw, move, and launch players in hammer. These may not be the only 3, but these are the 3 of which I come across a lot and 3 of which you should know about.

    The 3 triggers being discussed are trigger_push, trigger_catapult, and trigger_apply_impulse.
    • You may know trigger_push from invasion maps such as watergate and probed, in which you get sucked into an alien spaceship.
    • You may know trigger_catapult from PASS time maps in which you get launched off of many small ramps.
    • You may know trigger_apply_impulse from the Halloween map, Carnival of Carnage, in which you get flung into the air by a hammer of death.

    This tutorial expects you to have basic knowledge of entities and brush based entities already and only explains 3 specific ones and their applications.

    Want a video? HERE YA GO:
    View: https://youtu.be/Gd8LfEYwvYM


    Now for the text tutorial, which is a bit more in depth in some parts.

    TRIGGER_PUSH

    It does what it says it does. It pushes a player in a set direction with a set amount of power (speed).
    4145b6918d0491fcaac2230c114632a1.png
    The push direction can also be upwards, which is nice. Although it will not push a player upwards unless he is already in the air. Instead what will happen, is that you will experience slight jittering and move normally on the ground.
    A good way to counter this is by either placing them in the air by any means (could be even 1 hammer unit in the air) or by raising the trigger_push so that the player cannot even reach it unless he is in the air already.

    HOW TO USE IT
    There are many uses for this. You could make a sliding ramp, a slippery surface, a massive fan, etc.
    A popular use in community maps is for a ladder. Since it only pushed you upwards once it is in the air, a map maker may put one next to a ladder with a speed of around 1200.
    [​IMG]the trigger on the left ladder is raised up to avoid screen jitter.

    Another example is for ramps. This used to be the go-to way to launch players, but it can be made easier with trigger_catapult, which we will talk about later. If you push a player in the direction of the ramp and the player can walk up the ramp (kind of), then the player will be launched off of it.
    The hang time and max height depend on how the player got onto the ramp and our good old friend, High-School physics.
    [​IMG]

    I have 3 ramps set up. The largest is 128x192 hammer units, the middle one is 128x128 and the smallest one is 128x64 hammer units. Due to physics, the largest hang time would be out middle one, which is at a 45-degree angle, and the max height would be the one with the highest angle, out largest one.

    The problem is with our smallest one, which does nothing really when we approach it with low velocity from the ground. If we jump onto our angled brushes toward the direction of the brush, it will throw us a lot farther than the small one. That's just how charging works speed and ramps.


    The final use would be for an alien space ship as in the invasion maps. This is just many trigger_push brushes, pushing towards the space ship's center. Nothing complicated.

    TRIGGER_CATAPULT
    Now this one's got a lot of parameters. Many of which I haven't touched yet. Feel free to mess around.
    [​IMG]
    What this basically does, is catapult a player towards the desired entity. Due to it catapulting towards a specific something, the directions doesn't exactly matter with default settings. Anyone in a large trigger will go in different directions based on where the entity is located.

    Of course, it has a lot of parameters which I never bothered to mess with, so feel free to mess around and tell me what you come up with. The one I really pay attention to is the Launch Target.

    Launch Target?
    the launch target is commonly the entity called info_target, but it can be whatever you'd like! It can even be another trigger_catapult! All triggers have an origin, which acts as the entity in reference to leaks and, unsurprisingly, launch targets!
    If you set it to another brush based entity, the launch target is the origin, even if you move it around. You can basically save on entity use by using other entities you already have as the destination.

    But wait, if you can use an origin....and the trigger_catapult has an origin...can I use the trigger_catapult that I'm using as the destination?
    YES
    To further save on all those info_targets that you so desperately need to not have (you weirdo), you can have the name of the destination set to the name of your trigger_catapult, as I've done so here:
    [​IMG]

    TRIGGER_IMPULSE
    This little guy will launch you upwards with no set entity to target. So just a general direction, allowing for strafing.[​IMG]

    I'm an idiot and named it "impule1" instead of "impulse1", but that's beside the point.
    You can choose directions other than upwards, but you must be in the air for it to do anything - basically the opposite of trigger_push. Maybe use them in conjunction with each other!

    Now, the weird thing about this trigger is that it does nothing unless it gets an ApplyImpulse input.[​IMG]
    it can be a button, a trigger, whatever you'd like - but something must send an ApplyImpulse as an output to your trigger_apply_impulse in order for it to...well...apply an impulse!

    But wait! Can we save on entities yet again?! YES, YES WE F***ING CAN!
    Since the trigger_apply_impulse is, in fact, a trigger, it can send OnStartTouch Outputs. This means that we can have an output on the very same trigger that says to apply an impulse to itself:
    [​IMG]
    The !self entity is a handy little selector that acts like .self in javascript. It selects the entity that the output is on, namely our very own trigger_apply_impulse.

    With that method, you can have a trigger_apply_impulse that makes you flung upwards once it's touched.

    Now, how do we make what the hammer in Carnival of Carnage does?
    What that is, is 3 cylindrically shaped triggers, of varying sizes, all inside each other.
    [​IMG]
    Since these guys can stack and add up their impulse force, the ones in the middle will have a greater force, making it seem as if it's an actual decaying crash, providing the biggest shake when you are nearest to it.
    Each one is different in size, but with the same parameters:
    [​IMG]

    And that's about it! You want the VMF so you can mess around yourself? why not, here ya go:
     

    Attached Files:

    • Thanks Thanks x 4