These forums are CLOSED. Please visit the new forums HERE
llTargetOmega Goes by World Axis? |
|
|
OmniCron Overlord
Registered User
Join date: 28 Nov 2005
Posts: 31
|
08-14-2007 09:59
I have an interesting problem. Using the default rotating script I make a cylinder spin like a rotisery or fire spit. This works fine until i rotate the object 90 degrees and the object changes to spinning on the same GLOBAL axis so instead of rotating the whole cylinder spins around one end. Mind you this happens by simply rotating the object not making any change to the script. Does this mean llTargetOmega is now borked?
|
|
Jotheph Nemeth
Registered User
Join date: 9 Aug 2007
Posts: 142
|
08-14-2007 13:22
I have an interesting problem. Using the default rotating script I make a cylinder spin like a rotisery or fire spit. This works fine until i rotate the object 90 degrees and the object changes to spinning on the same GLOBAL axis so instead of rotating the whole cylinder spins around one end. Mind you this happens by simply rotating the object not making any change to the script. Does this mean llTargetOmega is now borked? According to the wiki: When the object is physical llTargetOmega affects the local axis of rotation. When the object is non-physical llTargetOmega effects the global axis of rotation What you might do is set the values based on llGetRot() first, then you can make sure it always rotates along the same local axis regardless of it's angle. |
|
Jotheph Nemeth
Registered User
Join date: 9 Aug 2007
Posts: 142
|
08-14-2007 13:26
I believe Christopher Omega already solved the problem. I found this on the wiki:
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llTargetOmega float lastCall = -1; // To avoid destroying the value of llGetTime by calling llResetTime. targetOmega(vector axis, float spinrate, float gain) { spinRate *= llVecMag(axis); // To compensate for normalizing. axis = llVecNorm(axis); if (lastCall != -1) // If we were spinning... llSetRot(llAxisAngle2Rot(axis, spinRate * (llGetTime() - lastCall))); llTargetOmega(axis, spinrate, gain); lastCall = llGetTime(); } |