• Add vector to local pos
    3 replies, posted
So I want to add a dynamic light o an entity, But I want to light to be in front of the object. OBV when I do eneity:GetPos()+Vector(50,0,50) it works until the object is rotated, Because its add the vector in world space, So how would I add to the local x position on the entity? Thanks
[lua]entity:GetPos() + (entity:GetAngles():Forward() * 50) + Vector(0, 0, 50)[/lua]
You can also use the Ent:LocalToWorld helper-function which removes the need to use self:GetPos +... [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/entities/positioning_entities_relative_to_another.lua.html[/url]
LocalToWorld also accounts for rotation, so it should definitely be used if you want it to follow a point on or near the entity.
Sorry, you need to Log In to post a reply to this thread.