Jump to content
Sign in to follow this  
Nikkesa

Vertical_attraction_timescale to work on any vector?

Recommended Posts

Well, so far as I know, one can only make a vehicles vertical attraction timescale attractive towards the worlds z-axis... Does anyone know how this can be done on a different axis?

Share this post


Link to post
Share on other sites


Nikkesa wrote:

Well, so far as I know, one can only make a vehicles vertical attraction timescale attractive towards the worlds z-axis... Does anyone know how this can be done on a different axis?

I'm a bit confused with what you're wanting to do. "Vertical attraction", by definition, deals with the realignment of the root's local z-axis with the world z-axis. Could you clarify what you wish to override in that behavior?

Share this post


Link to post
Share on other sites

ah, sorry;

What I want to do is change it so that instead of aligning the vehicles z-axis with the worlds z-axis, I want to be able to align the vehicles z-axis with any vector that I chose.

 

Wondering if this is possible, or if I have to skip the vehicle library all together and make my own version of this...

Share this post


Link to post
Share on other sites


Nikkesa wrote:

ah, sorry;

What I want to do is change it so that instead of aligning the vehicles z-axis with the worlds z-axis, I want to be able to align the vehicles z-axis with any vector that I chose.

 

Wondering if this is possible, or if I have to skip the vehicle library all together and make my own version of this...

I think you could do this by computing the difference between the vehicle's axis and your desired axis, then using a fraction of that difference vector as VEHICLE_ANGULAR_MOTOR_DIRECTION. That should start the vehicle moving in the direction of your desired axis. The trick will be to stop that motion when the vehicle reaches the target direction.

If you start and stop the turn instantaneously, you can use a timer to set the duration of the turn so that you stop on heading. You get a fast start and constant rotation speed by setting a very low (or zero?) VEHICLE_ANGULAR_MOTOR_TIMESCALE and a very long VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE. If you divide the difference vector by the desired elapsed time for the turn, and then set a timer for that same time, you should be able to stop the turn just as the vehicle reaches your desired heading. You can probably achieve a quick stop by supplying a motor direction vector of zero with very small (or zero?) VEHICLE_ANGULAR_FRICTION_TIMESCALE.

If you want the turn to start and stop smoothly, you could increase the VEHICLE_ANGULAR_MOTOR_TIMESCALE and decrease the VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE and play those two parameters against your VEHICLE_ANGULAR_MOTOR_DIRECTION. It should be possible to set the acceleration and deceleration such that one impulse will bring you around to the desired heading without need for a timer event to stop the rotation. If I were going to do this, I'd first get the math working to bring the vehicle around in the proper direction using a small fraction of the difference vector (so you can watch it turn), then play with the timescales to get it to stop correctly. A bit of calculus would probably provide you with the right numbers, but it'll be easier to experiment. Fortunately, once you've found the right timescales, they'll work for any direction change as everything just scales with the difference vector's magnitude.

I've probably made this sound easier than it is.

Good luck!

;-)

 

Share this post


Link to post
Share on other sites

Alright, so basically I WOULD have to do it manually, the lindens never bothered to think that maybe we would want our ground vehicles banking or something xD

 

Aw well, manually isn't much of a problem. I'm not using the vehicle library for this now, as it was the only thing holding my back \0/

 

Thanks :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...