Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Vehicle (Airplane) rotating on y-axis - ugh..

Seijaku Baran
Registered User
Join date: 30 May 2008
Posts: 5
12-19-2008 03:15
I've seen similar asked a few times, but a search didn't reveal any solutions that actually worked for me.

The vehicle script is working great. Linear motor pushes up/down/forward/back (Or combinations of, for up+forward etc), angular to bank-turn comes out perfect to how I want it.

..However. When bumping in to things, the y-axis often gets offset. I don't want this to any degree. It should always have a level y-axis, but everything I've tried either fails, fails miserably or fails with added side-effects.

Are there any tried and tested ways of getting an airplane-based vehicle script to maintain a level y-axis, while allowing smooth banking and such?

TIA.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-19-2008 12:45
I'm guessing you actually mean the x-axis, since that's the "forward" vector in SL, which would produce the Roll that make for pretty banking. y-would be Pitch (nose up/down), z would be Yaw (nose left/right).

at any rate there are a few methods, none all to pretty, you can lock the axis that is problematic with SetStatus, but that eliminates banking, you can try checking rotation and either manually righting it within a certain bounds, or using a damped rotation. you could just check a few seconds after any collision, and apply a one time correction. or you could add it as a user control.

for fun you could also lock yaw instead, and build a model closer to the modern fly-by-wire, where there are only controls for pitch and roll (to turn you roll then pitch up.... generally)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Seijaku Baran
Registered User
Join date: 30 May 2008
Posts: 5
12-19-2008 16:29
Ah, nope, I meant the y-axis. I want to prevent any pitch of the nose, up or down.

I've tried an llSetStatus to lock the y-axis (But I even recall a thread from a Linden saying bad idea on that), but it didn't work.

I tried a manual shift of the rotation, constantly ensuring the y-axis was always zero'd out, but that resulted in a bizzare side-effect of banking only working one way.

I also tried a method involving the vehicle model (I don't recall the exact function call), but that's rumoured to only work in pre-havoc 4.

I also tried a collision based adjustment, but for some reason I couldn't get it to respond to SL-ground collisions, only object collisions (hitting another prim).

And so the journey continues.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-19-2008 17:41
which functions did you try for correcting rotation? have you tried rotLookAt? how about oddball fixes that may right it, like setting bouyancy (never tried it, dunno), applying an outside force like an applied impulse? how about rotTarget and rot2up?
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Seijaku Baran
Registered User
Join date: 30 May 2008
Posts: 5
12-21-2008 03:44
Sorry for the delay in response...

I hadn't tried any of the ways you asked about before, so I did some testing just a few minutes ago.

llRotLookAt seems to have almost the desired effect, except that it's preventing it from turning now.

This is probably a messy way of doing it, but I've never used the function before, so I had to just wing it (No pun intended)...

CODE

rotation rot = llGetRot();
llRotLookAt(rot - <0, rot.y, 0,0>,.2,.1);
CODE


I dare say the problem is being caused by the way I'm implementing this, so if you have any pointers on how to do this, I'd appreciate it.

In essence, it is doing what I need. It's levelling it out after a collision etc, which is exactly what I want. But is there a way to get it to only affect one axis, otherwise banking stops working. (This is why I tried the Rot - <0,*,0,0> technique, to get it to remove only the y axis, but.. Still didn't work well.

TIA.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-21-2008 05:13
immediately cancel the llRotLookAt after calling it using llStopLookAt. that;; restore your normal turning/banking... may need to spped up your force and damping though.

PS I'm not so sure about your method of stripping the y element of the rotation, but if it's working, I say go for it (though you can get there quicker by just using rot.y = 0 on the preceding line, more code, but less math and faster to process)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Seijaku Baran
Registered User
Join date: 30 May 2008
Posts: 5
12-21-2008 07:13
Thanks again...

I tired a llStopLookAt in there too. Resulted in a sort of choppy/jumpy turning. I'll adjust to use the other way of cancelling out the y-axis - I thought you could only read from a rot with .x/.y etc, not set the rot floats, although now I think about it, it seems obvious that you can :D

Will try some more and see what happens.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-22-2008 20:34
From: Seijaku Baran
Thanks again...

I tired a llStopLookAt in there too. Resulted in a sort of choppy/jumpy turning. I'll adjust to use the other way of cancelling out the y-axis - I thought you could only read from a rot with .x/.y etc, not set the rot floats, although now I think about it, it seems obvious that you can :D

Will try some more and see what happens.

up can definelty set them, use the .r*=-1 trick to swap rotation directions for things like swings pendulums, etc... does wonders.

granted the rot look at combo is going to be fast and "choppy" but then, so is the result of running into objeccts.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -