How to get a vector position from behind a player?
1 replies, posted
I'm trying to figure out how get a vector position from behind a player with some distance .
Get the forward vector of the player and multiply it by the distance you want to move backward, and add that to the player's position.
[code]
--Move 100 units behind the player
local distance = -100
-- Get the forward normalized vector of the player
local norm = ply:GetAngles():Forward()
-- Scale the normal vector with the distance, and add it to the player's position
local position = ply:GetPos() + norm * distance
[/code]
Sorry, you need to Log In to post a reply to this thread.