Can you DIRECTLY set or stop a player's momentum/velocity?

TheMightyGerbil

L2: Junior Member
Dec 23, 2012
79
21
After attempting to find a solution in hammer, googling and searching the forums I ask is there an entity, flag or input to set a player's velocity to 0? I've got a teleport set up and need the player to come through it without their momentum or they go flying off center rather than dropping straight down. SetSpeed, !activator, parameter 0 didn't seem to work and I don't know which, if any, of the other entities or inputs may be applied directly to the player.

I've had success with a trigger_catapult killing momentum but it's preferable if I can set the velocity directly on the player, on teleporting, rather than a brush which others could run into. If there isn't an entity or input that does it directly I'll look into toggling the catapult on teleport but I'd still prefer a simpler, more direct solution.

I thought I'd ask before needlessly hunting for something that doesn't exist when someone may already know. Thank you!
 
Mar 23, 2013
1,013
347
Try this output: OnStartTouch - !activator - Addoutput - Basevelocity 0 0 0


Actually, I'm working on a map that uses teleporters and I'm using clip brushes at the destination to stop the players... why didn't I think of this sooner? I feel stupid now.
 

TheMightyGerbil

L2: Junior Member
Dec 23, 2012
79
21
Is that the exact syntax for the parameter because I'm trying it on both a trigger_teleport and trigger_multiple and not getting a result.

Would one of these functions work? https://developer.valvesoftware.com/wiki/Velocity#Application

I've never input a function as a parameter so I don't know the syntax, or even that you could, so I may be getting something off, I am copy pasting though.
 
Last edited:

TheMightyGerbil

L2: Junior Member
Dec 23, 2012
79
21
Ok I think I see the problem. OnStartTouch - !activator - Addoutput - Basevelocity 0 0 1000 will add velocity but it's additive to the values you already have, not a reset to existing values. It needs to kill all momentum.
 

TheMightyGerbil

L2: Junior Member
Dec 23, 2012
79
21
Hmm setting it to a high negative value forces the player down negating some, but not all, of the momentum. Unfortunately this won't work either because you have to set it so high you take damage. If there was a way to get a player's current velocity and input a negative of those numbers it could work but that seems elaborate and probably not possible. The catapult seems the best option atm. Thanks for trying I learned things if nothing else. Let me know if you come up with something though :) .
 
Mar 23, 2013
1,013
347
Yeah I was just testing it and it does add to the velocity you have. Man, I could swear it worked differently some years ago. Someone made a test map with jump pads and the baseVelocity thing also took the players aircontroller compleetly, so the jumppads using this command let the player land always on the exact same spot, so I'm suprised that 0 0 0 doesn't work. I looks like the way it works has been changed over the time.

Well, perhaps I can at least give you some advice for teleporters to give them a better effect. So what I did is placing a env_fade with the flag "activator only" enabled. This flag is hidden, read here how to enable: https://developer.valvesoftware.com/wiki/Env_fade
Give the teleport trigger the output "OnStartTouch - env-fade's targetname - fade
Now only the player using the tele will see a white flash while using it, instead of just a sudden change of scenery.
Additionally I let the player hear a soundeffect by placing a point_clientcommand and giving the teleporter this output: "OnStartTouch - clientcommand's targetname - command - play <Sound name>

Go through the sound browser and use a soundeffect you like and replace it with <Sound name>
 

TheMightyGerbil

L2: Junior Member
Dec 23, 2012
79
21
Yeah I was just testing it and it does add to the velocity you have. Man, I could swear it worked differently some years ago. Someone made a test map with jump pads and the baseVelocity thing also took the players aircontroller compleetly, so the jumppads using this command let the player land always on the exact same spot, so I'm suprised that 0 0 0 doesn't work. I looks like the way it works has been changed over the time.

Well, perhaps I can at least give you some advice for teleporters to give them a better effect. So what I did is placing a env_fade with the flag "activator only" enabled. This flag is hidden, read here how to enable: https://developer.valvesoftware.com/wiki/Env_fade
Give the teleport trigger the output "OnStartTouch - env-fade's targetname - fade
Now only the player using the tele will see a white flash while using it, instead of just a sudden change of scenery.
Additionally I let the player hear a soundeffect by placing a point_clientcommand and giving the teleporter this output: "OnStartTouch - clientcommand's targetname - command - play <Sound name>

Go through the sound browser and use a soundeffect you like and replace it with <Sound name>

I'd probably just use an ambient_generic for a teleport sound, I'd want everyone to hear the sound anyway, but the env_fade sounds like a nice detail I may put in :) . I've been mapping off and on for half a decade but mainly only bread and butter game modes. I've generally avoided the exotic entities and settings but had an idea for doing something different yesterday.
 

TheMightyGerbil

L2: Junior Member
Dec 23, 2012
79
21
AFAIK point_teleport kills existing momentum.

I'm not sure how I'd target a specific player with that entity? Even if you can what I am doing requires the exit point be parented to a moving brush and point_teleport appears to have no parenting option or way to target another entity. Thanks for the suggestion though :) .
 

Izotope

Sourcerer
aa
May 13, 2013
698
764
Set entity to be teleported to !activator and give it the Teleport input.
You could put this in an empty box outside the map where an additional trigger_teleport is.
This would kill the momentum and you'd still get teleported to your moving destination.