Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Smooth fast turns

Zepp Zaftig
Unregistered Abuser
Join date: 20 Mar 2005
Posts: 470
12-26-2005 08:02
Anyone have any idea of how to make a vehicle turn fast, 360 degrees in 1-2s, with smooth motion? Seems whatever I try, the motion becomes jerky when it turns too fast.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
12-26-2005 15:14
I assume you're using vehicle code?


Personally I dislike said vehicle code, but anyway. Easiest way I'd think to do that would be to use a combination of llRotLookAt and forward momentum from the vehicle to get the desired effect. Don't forget to use llStopLookAt when you're done!
_____________________
---
Zepp Zaftig
Unregistered Abuser
Join date: 20 Mar 2005
Posts: 470
12-26-2005 16:34
I've tried using llRotLookAt, but I haven't been able to make it do what I want. Actually what I want is a hovering physical cylinder that constantly rotates at 1 rev / s and instantly changes direction of rotation if the left or right key is pressed, it is connected to a shaft and has to transfer force so I can't use llTargetOmega. I kinda got it working but the motion gets all jerky all the time.
Zepp Zaftig
Unregistered Abuser
Join date: 20 Mar 2005
Posts: 470
12-26-2005 16:43
Just to clarify, it's not supposed to actually be moving anywhere, only turn around. I just called it a vehicle because I need to use the keyboard to control it, but it's not really a vehicle though.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
12-26-2005 16:50
Something like this?

CODE
// Spins at about 1 rev per second

default
{
state_entry()
{
llMoveToTarget(llGetPos(),0.3); // Hover here
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE); // Rotate on Z only
llSetStatus(STATUS_PHYSICS, TRUE); // Turn on physics
llSetTimerEvent(0.1); // 0.1 second intervals
}
timer
{
llRotLookAt(llEuler2Rot(<0,0,PI / 5.0>) * llGetRot(),0.3,0.3);
// Spins at PI / 5 (TWO_PI / 10, or 0.1 rev every 0.1 seconds)
// I'm coding this in the post window, but I always forget the order of operations
// If this doesn't work, use this instead:
// llRotLookAt(llGetRot() * llEuler2Rot(<0,0,PI / 5.0>),0.3,0.3);
}
}
_____________________
---
Zepp Zaftig
Unregistered Abuser
Join date: 20 Mar 2005
Posts: 470
12-26-2005 17:00
From: Jeffrey Gomez
Something like this?


Yes, the timer did the trick, thanks. :)