Is there a way to lock entities to 0 on a specific axis?
I figured SetPos() would work:
[lua]E:SetPos(E:GetPos()*Vector(1,0,1))[/lua]
But the problem is the entity loses all of it's momentum when using that function, even when I do:
[lua]
local Speed = E:GetPhysicsObject():GetVelocity()
E:SetPos(E:GetPos()*Vector(1,0,1))
E:SetVelocity(Speed)
[/lua]
Is there another function I can use instead of SetPos() that will keep the velocity? Or would I need to resort to ApplyForceCenter()?
As always, thanks for any help.
Does anybody know?
[b][url=http://wiki.garrysmod.com/?title=Entity.SetVelocity]Entity.SetVelocity [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
[QUOTE]If the movetype of the entity is MOVETYPE_VPHYSICS (aka, if the entity uses physics simulations) you need to use :SetVelocity on the PHYSICS object of the entity.[/QUOTE]
Have you tried this?
[lua]
local Speed = E:GetPhysicsObject():GetVelocity()
E:SetPos(E:GetPos()*Vector(1,0,1))
E:GetPhysicsObject():SetVelocity(Speed)
[/lua]
Sorry, you need to Log In to post a reply to this thread.