Ferris Wheel
De DigiWiki.
For each part, make sure the Root Prim is Top:UP and Front:FORWARD relative to the orientation of each object, and that the script is in the root prim.
- Part 1 - WHEEL: a phantom targetomega rotated wheel made of linked prims, 20m diameter. Root prim must be positioned at the center of the ferris wheel. If you rotate the orientation of the wheel, make sure to reset the script before you let go of the wheel with the object editer.
- Part 2 - REZZER: a single stationary prim that rezzes the cars (carriages). Rezzer is positioned and aligned with the center/axis of the ferris wheel. Touching this prim will rez 8 temp_on_rez cars that will auto-position themselves
- Part 3 - CAR: (or carriage) of linked prims. the root prim holds the script and must be top-up/front-forward relative to the car. Cars are moved by MoveToTarget and synchronized by the clock. Root prim should either be or be aligned with the part that appears to connect to the wheel.
WHEEL SCRIPT
integer LOOP_DURATION=60; default { state_entry() { llSetStatus(STATUS_PHANTOM, TRUE); llTargetOmega(<0,1,0>*llGetRot(),6.25/LOOP_DURATION,1); } }
REZZER SCRIPT
default { state_entry() { llSetStatus(STATUS_PHANTOM, TRUE); integer i; string car_name = llGetInventoryName(INVENTORY_OBJECT,0); if ( car_name ) { for (i=1; i<=8; i++) { llRezAtRoot( car_name, llGetPos(), ZERO_VECTOR, llGetRot(), i); } } else llOwnerSay( "error: no car/carriage object found in rezzer" ); } touch_end(integer what) { if ( llGetTime() > 60 ) llResetScript(); else llSay(0,"Wait "+(string)(60-(integer)llGetTime()) +" seconds before rezzing more cars."); } }
CAR SCRIPT
// imported or computed below rotation AXIS_ROT; vector AXIS_POS; integer CAR_ID; integer CAR_ANGLE_OFFSET; // how far this car is behind the first car in seconds float UPDATE_INTERVAL; // re-compute trajectory once every 2 seconds. default { state_entry() { llSetStatus( STATUS_PHYSICS, FALSE ); llSetStatus( STATUS_PHANTOM, TRUE ); llSetBuoyancy( 1.0 ); llStopMoveToTarget(); llSetVehicleType( VEHICLE_TYPE_NONE ); } on_rez(integer param) { CAR_ID = param; CAR_ANGLE_OFFSET = ( LOOP_DURATION * CAR_ID / CARS ); AXIS_POS = llGetPos(); AXIS_ROT = llGetRot(); // perpendicular to carriage rot if ( TESTING && param ) llSetPrimitiveParams( [PRIM_TEMP_ON_REZ, TRUE] ); llMoveToTarget( llGetPos(), 1.0 ); llSetStatus( STATUS_PHYSICS, TRUE ); llSetTimerEvent( 2.0 ); llSetText("Car #"+(string)CAR_ID,<1,1,1>, 1.0); } timer() { float progression = ( llGetUnixTime() + CAR_ANGLE_OFFSET ) % LOOP_DURATION; float angle = TWO_PI * progression/LOOP_DURATION; vector destination = < llSin(angle)*RADIUS, 0.0, llCos(angle)*RADIUS> * AXIS_ROT + AXIS_POS; llMoveToTarget( destination, 4.0 ); } }