Hey there,
actually I want to get the relative position of an entity but the output is always: 0.000000 0.000000 0.000000
Here is my code:
concommand.Add( "entity_rpos", function( ply )
local eyetrace = ply:GetEyeTrace()
if ( IsValid( eyetrace.Entity ) ) then
print( "Relative entity position:", eyetrace.Entity:WorldToLocal(eyetrace.Entity:GetPos()) )
else
print( "No ent" )
end
end )
Any Ideas?
Cheers
You're converting the world position of the entity into a local position of the same entity. Of course it's 0, 0, 0, they're the same position.
LOL. I'm a dumbass. Thanks for this hint. HitPos is the way.
Sorry, you need to Log In to post a reply to this thread.