Setting a player's velocity to the opposite of their AimVector?
2 replies, posted
Hi facepunch.
I've been messing around with a swep for a while now, I essentially just want it to bounce you in the opposite direction to where you shot.
After toying with util.TraceLine and such, I've come to this point:
[CODE]
ply:SetVelocity( ply:GetAimVector():Rotate( Angle( 180, 0, 0 ) ) )
[/CODE]
[ERROR] addons/bounce/lua/weapons/weapon_bounce/shared.lua:92: bad argument #1 to 'SetVelocity' (Vector expected, got no value)
1. SetVelocity - [C]:-1
2. unknown - addons/bounce/lua/weapons/weapon_bounce/shared.lua:92
Any help?
You can reverse vectors by multiplying them by -1.
[lua]ply:SetVelocity(ply:GetAimVector()*-500)[/lua]
[IMG]http://puu.sh/4qjT5.png[/IMG]
Thanks a ton, ollie!
Sorry, you need to Log In to post a reply to this thread.