|
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
|
12-10-2008 16:35
ok, I'm awful at quantrans, what I want to do, is rotate and move a child prim around the parent prim. Think of a double door with the parent prim in the exact center of the set, and the doors swing open and out away from the parent prim. I have done this before using trig, but there must be a way to do it without trig, and using quantrans.
I don't need to be pointed to a door script or anything, this is for my own knowledge for later on. Thank you in advance.
|
|
Klug Kuhn
Registered User
Join date: 7 Sep 2007
Posts: 126
|
12-10-2008 17:45
To move the child prim: http://wiki.secondlife.com/wiki/LlSetPosTo rotate the child prim: http://wiki.secondlife.com/wiki/RotationThose should get you started. You need to consider both moving and rotating in regard to doors which have the centers NOT at the hinge.
|
|
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
|
12-10-2008 21:24
Not working right, it offsets wrong at the end on the return. Need a guru who understands this quantran stuff, I really don't want to go back to trig 
rotation rot6x; vector offset = <0.4, 0, 0>; vector rotatedOffset; vector newPos; rotation newRot;
default { state_entry() { rot6x = llEuler2Rot(<0, 0, 15> * DEG_TO_RAD); rotatedOffset = offset * rot6x; }
touch_start(integer total_number) { integer step; for(step = 0; step < 6; step++) { newPos = llGetLocalPos() + (offset - rotatedOffset * rot6x) * llGetLocalRot(); newRot = rot6x * llGetLocalRot(); llSetPrimitiveParams( [PRIM_POSITION, newPos, PRIM_ROTATION, newRot] ); } llSleep(3.0); rot6x = llEuler2Rot(<0, 0, -15> * DEG_TO_RAD); rotatedOffset = offset * rot6x; for(step = 0; step < 6; step++) { newPos = llGetLocalPos() + (offset - rotatedOffset * rot6x) * llGetLocalRot(); newRot = rot6x * llGetLocalRot(); llSetPrimitiveParams( [PRIM_POSITION, newPos, PRIM_ROTATION, newRot] ); }
} }
|