engine.RotVelocity.Vector3.y = (vehicleSeat.Steer*steeringSpeed)
I know, the line above is totally broken. How do I move Vector3.y only without moving x and z?
A Vector3
doesn't have a Vector3
property, so obviously your line is wrong.
It does have a y
property, though, so it might look like this:
engine.RotVelocity.y = vehicleSeat.Steer * steeringSpeed;
However, we can see here that all of a Vector3's properties are read only.
We have to set the Vector3 value as a whole.
If you want the X and Z values to be zero, it's easy to just construct a new one:
engine.RotVelocity = Vector3.new( 0, vehicleSeat.Steer * steeringSpeed , 0);
If you want this to not affect the X, and Y values, we can either do a little amount of Vector math, or just read the coordinates ourselfs:
local previous = engine.RotVelocity.y; local withoutY = previous * Vector3.new(1, 0, 1); -- Does component-wise multiplication local Y = Vector3.new( 0, vehicleSeat.Steer * steeringSpeed , 0); engine.RotVelocity = withoutY + Y;
or
local previous = engine.RotVelocity; engine.RotVelocity = Vecto3.new( previous.x, vehicleSeat.Steer * steeringSpeed, previous.z );