|
Fenix Eldritch
Mostly harmless
Join date: 30 Jan 2005
Posts: 201
|
01-20-2009 06:51
I'm going through the wikis and examples to try and make a vehicle. I understand that much of it is really just experimenting with the various parameters to get the type of behavior wanted... but I noticed something. In most of the examples I've seen, these lines are present in the control event. llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angularvector); llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, linearvector) Typically the control event will have logic to modify the angular/linear vectors depending on what keys are held, pressed, released, etc. Now as I understand it, other VEHICLE parameters like MOTOR_TIMESCALE and MOTOR_DECAY_TIMESCALE are supposed to mimic acceleration/deceleration depending on what they are set to. The MOTOR_DIRECTION parameters are supposed to be like the top speeds that can eventually be achieved. However, I believe these timescale parameters only take effect immediately after the MOTOR_DIRECTION is set. That is, once you call the llSetVehicleVectorParam(VEHICLE_***_MOTOR_DIRECTION parameter); command, the timescales start working to bring the vehicle up to speed, and then eventually decay back to zero. Soooo... my question (finally) is this: is it wrong to have the MOTOR_DIRECTION in the control event? By putting it there, won't it be reset EVERY time the event is called (which is every time a button is pressed, and many many times while it is being held down) ? And as such, will that effectively screw with the timescales and make them pretty much ineffective?
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
01-20-2009 17:39
I think the only thing that REALLY resets when you set the motor directions is the point where the decay starts. My suspicion (somewhat backed by experience) is that the timescale is really the amount of time it takes to change the linear/angular velocity form the CURRENT velocity to that set by the motor. Similar to the damping values used by functions like llMoveToTarget() and llRotLookAt(), but controlling velocity rather than position.
So I don't think it is WRONG to set the motor directions from every control event, but it's going to depend a bit on the other vehicle parameters and the feel you want your vehicle to have. In the latest vehicle I built, I actually set the timescales very small and manually calculated what velocity to achieve with each control event, so that I could control acceleration very closely. I could have let the timescales take care of the acceleration for me instead (and instead just set maximum speed on the motor directions), but this was part of a larger implementation and I wanted to make it very consistent with the other physical and non-physical movement modes integrated in.
|