Car Movement.

My question is -quite- simple. I was bored so I wanted to make a car entity: it is controlled by its’ owner like that:

[lua]
function ENT:Think()

local angles = self:GetOwner():EyeAngles()
local carangles = self:GetAngles()
	
self:SetAngles( Angle( carangles.p, angles.y, carangles.r ) )

if ( v:KeyDown( IN_FORWARD ) ) then

	-- TODO

elseif ( v:KeyDown( IN_BACK ) ) then

	-- TODO

end

end
[/lua]

I know, this system is bad but I don’t care about that. Basically, I want the car to move depending on its’ angles.

What is the problem? :o
To me, that code seems to work good, except that y on EyeAngles is up/down aim, so you would want x on that.

I want the car to move forwards depending on its’ angle.

You would do like, Car:SetPos(Car:GetForward()*10+Car:GetPos()). You might want to change GetForward to something else.

I’ll try. Thanks.

It works. Thank you very much for the answer.

Use **[ENT.PhysicsSimulate

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=ENT.PhysicsSimulate)** Insted and here is an example of using it
http://luabin.overvprojects.nl/?path=/gamemodes/base/entities/entities/base_vehicle/shared.lua

I was using the same method as you in my tank gamemode then I was advised to use PhysicsSimulate and its really much better