Author Topic: Speed decay  (Read 620 times)

Is there anyway to make a vehicle's forwardThrust decrease at a steady or exponential rate until it gets down to zero?

Not without causing it to apply to all such vehicles across the server.

what about having it start at e.g. 5000 and then change to 0 after a certain amount of time?

Not without causing it to apply to all such vehicles across the server.

Or you could run an add velocity loop to slow the vehicle down without messing with member properties

Or you could run an add velocity loop to slow the vehicle down without messing with member properties

That doesn't have vaguely the same effect. Both his suggestions would cause you to lose power/coast for a time. Heavyhandedly changing the vehicle's velocity will be very obvious if loss of control is the intended effect.

ok so what about adding velocity relative to the player, adding it forwards and having the ForwardThrust set to 0, that way you'd start out fast and slow down. I tried using the AddRelativeVelocity event's code, but I'm not really sure how to call it in a function properly.
Code: [Select]
%obj.getRelativeVelocity();
Code: [Select]
%newcar.addRelativeVelocity("0 25 0");
Code: [Select]
function player::getRelativeVelocity(%player,%xyz)
{
%x = getWord(%xyz,0);
%y = getWord(%xyz,1);
%z = getWord(%xyz,2);
%forwardVector = %player.getForwardVector();
%forwardX = getWord(%forwardVector,0);
%forwardY = getWord(%forwardVector,1);
}

function newcar::addRelativeVelocity(%newcar,%xyz)
{
%x = getWord(%xyz,0);
%y = getWord(%xyz,1);
%z = getWord(%xyz,2);
%forwardVector = %newcar.getForwardVector();
%forwardX = getWord(%forwardVector,0);
%forwardY = getWord(%forwardVector,1);
%newcar.addVelocity((%x * %forwardY + %y * %forwardX) SPC (%y * %forwardY + %x * -%forwardX) SPC %z);
}

That doesn't have vaguely the same effect. Both his suggestions would cause you to lose power/coast for a time. Heavyhandedly changing the vehicle's velocity will be very obvious if loss of control is the intended effect.
It does have vaguely the same effect. It's obviously not perfect, but I suggested it as a completely valid alternative if nothing else were to work