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

Discussion in 'Mapping Questions & Discussion' started by TheMightyGerbil, Oct 9, 2017.

  1. TheMightyGerbil

    TheMightyGerbil L1: Registered

    Messages:
    37
    Positive Ratings:
    8
    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!
     
  2. Lampenpam

    aa Lampenpam

    Messages:
    1,019
    Positive Ratings:
    337
    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.
     
    • Like Like x 1
  3. TheMightyGerbil

    TheMightyGerbil L1: Registered

    Messages:
    37
    Positive Ratings:
    8
    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: Oct 9, 2017
  4. TheMightyGerbil

    TheMightyGerbil L1: Registered

    Messages:
    37
    Positive Ratings:
    8
    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.
     
  5. TheMightyGerbil

    TheMightyGerbil L1: Registered

    Messages:
    37
    Positive Ratings:
    8
    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 :) .
     
  6. Lampenpam

    aa Lampenpam

    Messages:
    1,019
    Positive Ratings:
    337
    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>
     
    • Thanks Thanks x 1
    • Like Like x 1
  7. TheMightyGerbil

    TheMightyGerbil L1: Registered

    Messages:
    37
    Positive Ratings:
    8
    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.
     
    • Like Like x 1
  8. Izotope

    aa Izotope Never releases maps

    Messages:
    620
    Positive Ratings:
    585
    AFAIK point_teleport kills existing momentum.
     
    • Thanks Thanks x 1
  9. TheMightyGerbil

    TheMightyGerbil L1: Registered

    Messages:
    37
    Positive Ratings:
    8
    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 :) .
     
  10. Izotope

    aa Izotope Never releases maps

    Messages:
    620
    Positive Ratings:
    585
    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.