Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

ladder prim movement/rotation?

Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
05-15-2008 18:08
im trying to create a ladder truck that will take control of your avatar and the main problem im having is how to get the roations and movement. so the way all the rotations and movements are from the middle of the prim witch means you need to know trig to basicly move the prim and add roatation to make it look like it is moveing perfectly, dose anyonw know anything on hoew to make something like that or even give a example on how to get it?
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
05-15-2008 18:37
here is what i got so far dosent work tho >.>

CODE

vector angle;
rotation rot_xyzq;
default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
}

touch_start(integer total_number)
{
llRequestPermissions(llDetectedKey(0), PERMISSION_TAKE_CONTROLS);
}
run_time_permissions( integer perm )
{
if(perm == PERMISSION_TAKE_CONTROLS)
{
llTakeControls(CONTROL_FWD | CONTROL_BACK | CONTROL_DOWN | CONTROL_UP | CONTROL_RIGHT | CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT, TRUE, FALSE);
}
}
control(key id, integer level, integer edge)
{
vector angles_in_radians = angle*DEG_TO_RAD; // Change to Radians
rot_xyzq = llEuler2Rot(angles_in_radians); // Change to a Rotation
integer start = level & edge;
integer end = ~level & edge;
integer held = level & ~edge;
integer unheld = ~(level | edge);
if(held && CONTROL_BACK)
{
angle = <0,1,0>;
llSetRot(llGetRot()*rot_xyzq); //Do the Rotation...
angle = <0,0,0>;
}
if(held && CONTROL_FWD)
{
angle = <0,-1,0>;
llSetRot(llGetRot()*rot_xyzq); //Do the Rotation...
angle = <0,0,0>;
}
}
}