"Fixed rotate" script?

Creating scripts
User avatar
Ozwell Wayfarer
Posts: 570
Joined: Thu Jan 10, 2013 10:32 am
Has thanked: 832 times
Been thanked: 955 times

"Fixed rotate" script?

Post by Ozwell Wayfarer »

I am making a windmill at the moment and it has a few rotating parts. The scripts I can currently find for rotation use the llTargetOmega command whereby you have to define an axis for the rotation to move along.

Problem is that when you rotate the structure the script can not recognise, leading things to spin in strange directions. Does anyone know a workaround for this?

Thanks!!
User avatar
Ilan Tochner
Posts: 6528
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4992 times
Been thanked: 4473 times
Contact:

Re: "Fixed rotate" script?

Post by Ilan Tochner »

Hi Ozwell,

Please make sure to only rotate phantom objects, otherwise your constantly rotating objects will create high CPU load for your sim.
These users thanked the author Ilan Tochner for the post (total 2):
Alexina ProctorOzwell Wayfarer
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: "Fixed rotate" script?

Post by Graham Mills »

This is from the SL wiki except I changed llRot2Up to llRot2Left. It worked OK with a two prim linkset in which the script was in the child prim representing the sail. YMMV. PS sent you a full-perms copy.

Code: Select all

default
{
    state_entry()
    {
       llTargetOmega(llRot2Left(llGetLocalRot()), PI, 1.0);  
    }
}
These users thanked the author Graham Mills for the post (total 2):
Alexina ProctorOzwell Wayfarer
User avatar
Ozwell Wayfarer
Posts: 570
Joined: Thu Jan 10, 2013 10:32 am
Has thanked: 832 times
Been thanked: 955 times

Re: "Fixed rotate" script?

Post by Ozwell Wayfarer »

Thanks Graham. Unfortunately this script still seems to suffer the same problem when applied to my windmill blades. Maybe its an issue with mesh here?

The blades are 1 physical object and the script works when applied. But if I then change the rotation from true north to true east, the blades stop rotating around the central axis and start moving blade over blade (if that makes sense?).

EDIT - Actually, when the scripted blade is linked in (NOT as the root prim) to the rest of the structure it works! Thanks Graham :) I will send you over a copy of the windmill when I am done.
User avatar
Handy Low
Posts: 231
Joined: Fri Nov 08, 2013 3:38 pm
Location: Yorkshire, England
Has thanked: 207 times
Been thanked: 140 times
Contact:

Re: "Fixed rotate" script?

Post by Handy Low »

[EDIT: Never mind, I was thinking about animation rotation when I first wrote this post]
Last edited by Handy Low on Sun May 31, 2015 10:15 am, edited 1 time in total.
Handy Low
User avatar
Handy Low
Posts: 231
Joined: Fri Nov 08, 2013 3:38 pm
Location: Yorkshire, England
Has thanked: 207 times
Been thanked: 140 times
Contact:

Re: "Fixed rotate" script?

Post by Handy Low »

Ilan Tochner wrote:Please make sure to only rotate phantom objects, otherwise your constantly rotating objects will create high CPU load for your sim.
How can this be, when llTargetOmega() is a client-side effect?
Handy Low
User avatar
Ilan Tochner
Posts: 6528
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4992 times
Been thanked: 4473 times
Contact:

Re: "Fixed rotate" script?

Post by Ilan Tochner »

Please see: http://wiki.secondlife.com/wiki/LlTargetOmega

This effect is also simulated on the server (in other words it is NOT client side only) when the rotated object is non-phantom.
User avatar
Handy Low
Posts: 231
Joined: Fri Nov 08, 2013 3:38 pm
Location: Yorkshire, England
Has thanked: 207 times
Been thanked: 140 times
Contact:

Re: "Fixed rotate" script?

Post by Handy Low »

Only in physical objects, surely?
Handy Low
User avatar
Ilan Tochner
Posts: 6528
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4992 times
Been thanked: 4473 times
Contact:

Re: "Fixed rotate" script?

Post by Ilan Tochner »

Non-Phantom objects can be collided with. Every time they move the sim has to be updated to reflect that. If this isn't synchronized between clients then you may pass between the arms of a spinning object while other viewers might see you passing through the non-Phantom arms because their object spin start times aren't synced with yours.
These users thanked the author Ilan Tochner for the post:
Ozwell Wayfarer
User avatar
Handy Low
Posts: 231
Joined: Fri Nov 08, 2013 3:38 pm
Location: Yorkshire, England
Has thanked: 207 times
Been thanked: 140 times
Contact:

Re: "Fixed rotate" script?

Post by Handy Low »

Then the documentation is incorrect?
http://wiki.secondlife.com/wiki/LlTargetOmega wrote:If the object is not physical then the rotation is only a client side effect and it will collide as non-moving geometry.
Handy Low
Post Reply