Im trying to make a system where if you push f3 it will teleport the car to the last checkpoint, face you in the right direction and stop you. The teleporting works and I havent finished working on the angles but I cant get it to stop. So when you teleport you still have the same velocity at the moment. Iv tried SetVelocity and SetLocalVelocity but nothing is working. Any help will be greatly appreciated.
(No errors by the way)
[Lua]
function GM:ShowSpare1( ply )
local car = ply:GetVehicle()
local spawns = ents.FindByClass("checkpoint_spawn")
for k, v in pairs(spawns) do
if (v:GetNumber() == ply.Checkpoint) then
spawnpos = (v:GetPos() + Vector(0,0,100))
//spawnangle = v:GetAngles()
end
end
//car:SetPos(spawnpos)
car:SetVelocity(Vector(0,0,0))
//car:SetAngles(Angle(0,0,0))
end
[/Lua]
Set the velocity of the physics object.
Im guessing I would use [Lua]PhysObj.SetVelocity[/Lua] but I have no Idea how to
Read the wiki page for it, it will tell you how to use it.
I have but it seems like I would just do the same as I have above, I dont get what the difference between entity:SetVelocity() and PhysObj.SetVelocity() is?
The difference is that PhysObj.SetVelocity works.
SetVelocity is addative, iirc. You have to negate the velocity at which they're going to stop them.
i.e.
entity:SetVelocity(entity:GetVelocity() * -1)
[editline]21st December 2010[/editline]
[QUOTE=ralle105;26853098]The difference is that PhysObj.SetVelocity works.[/QUOTE]
Entity:SetVelocity does work, but only on players and NPC's
[QUOTE=Feihc;26853103]SetVelocity is addative, iirc. You have to negate the velocity at which they're going to stop them.
i.e.
entity:SetVelocity(entity:GetVelocity() * -1)
[editline]21st December 2010[/editline]
Entity:SetVelocity does work, but only on players and NPC's[/QUOTE]
Then why is it part of the Entity metatable?:raise:
[QUOTE=ralle105;26853151]Then why is it part of the Entity metatable?:raise:[/QUOTE]
Good question. O.o
Old error that never got fixed? Not sure.
I know before they added physobj:SetVelocity you had to use ApplyForce*
uhh i was just being dumb, thanks for your help
Sorry, you need to Log In to post a reply to this thread.