|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
10-02-2006 10:38
How do I get an object (nonphysical and nonflexi) to turn into the wind?
I'd like to make a flag on a pole, but the flexi flag looks stupid when the wind blows 180 degrees in relation to the flag.
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
|
Thanto Usitnov
Lord Byron wannabe
Join date: 4 Aug 2006
Posts: 68
|
10-02-2006 11:19
use llWind() to determine the direction of wind. Use llSetRot() to set rotation accordingly. Since you want this updated pretty quickly so it looks kinda nice, I suggest using 4 or 5 scripts running in tandem, each running an infinite loop setting the rotation. To make sure they don't all run at the same time, put in a delay before each one starts up. So, something like this for each script: default { touch_start(integer num_detected) { llSleep(0.0); //set the proper delay here while (true) llSetRot(llEuler2Rot(llWind(<0,0,0>))); //converts the wind vector into a rotation and sets rotation accordingly } }
The above script should rotate the object towards the wind. If you have 4 scripts, set the delays at .00, .05, .10, and .15. That will make it update once every 0.05 secons, which is pretty smooth.
|
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
10-02-2006 12:29
WHile I guess that probably makes sense in theory, in world, the result is something very od. The flagpole falls over, and begins spinning on all three axes. (in jerky little moves)
What I want.. in essence, is a cylander, with an arrow painted on it's top.. to always point directly into the wind, rotating only on it's Z axis..
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
|
Zeera Xi
Real Join Date: Mid '05
Join date: 21 Sep 2006
Posts: 54
|
10-02-2006 14:38
Dropped one onto you, hope it comes useful. Anyone who needs it just IM me for it. Its a compass with a wind-speed meter. Its based on rotating the texture but can be very easily modified to change the rotation instead by changing the core function of it.
PS: Tanto, Please, don't use While loops in such a Horrible and Nasty manner! It would be wasting Sim resources and slow down everything with a few while loops. The speed is unnecessary for the sake of slowing down everything.
|
|
ScriptScavenger Lei
Registered User
Join date: 3 Sep 2006
Posts: 14
|
complicated much ?
10-02-2006 19:07
From: Thanto Usitnov use llWind() to determine the direction of wind. Use llSetRot() to set rotation accordingly. Since you want this updated pretty quickly so it looks kinda nice, I suggest using 4 or 5 scripts running in tandem, each running an infinite loop setting the rotation. To make sure they don't all run at the same time, put in a delay before each one starts up. So, something like this for each script: default { touch_start(integer num_detected) { llSleep(0.0); //set the proper delay here while (true) llSetRot(llEuler2Rot(llWind(<0,0,0>))); //converts the wind vector into a rotation and sets rotation accordingly } }
The above script should rotate the object towards the wind. If you have 4 scripts, set the delays at .00, .05, .10, and .15. That will make it update once every 0.05 secons, which is pretty smooth. if im not mistaken the script loops quite fine on its own thus looping it would be redundant the line llSetRot(llEuler2Rot(llWind(<0,0,0>))); //converts the wind vector into a rotation and sets rotation accordingly
by its self would acomplish the whole script seting the rotation to the z axis only and the whole thing fits neatly into 4 lines (counting default and state_entry) why use more lines than u realy have to?
|
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
10-02-2006 19:44
Zeera's wind compass really did the trick. I had some problems implementing it into a flagpole, and she popped right over to help. We came up with a really cool pole that even puts a wiggle into the flag (so it doesn't look rigid in a strong wind).
If Zeera permits, I'll hapilly post the code for all to use.
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|