Spuds Milk
Registered User
Join date: 28 Sep 2004
Posts: 94
|
03-03-2005 16:56
The wiki says you can do it by multiplying a vector for the offset that you want the rotation center to be, but I odn't understand what they mean. I'm trying to rotate a 10m long prim (linked to other non-moving parts) around it's end, so can't use the cut method to modify the rotation point open() {
llSetPos(<1.96762, 0.00000, 9.87399>); llSetLocalRot( <0.00000, -0.70711, 0.00000, 0.70711> );
}
close() { llSetPos( <0.29000, 0.00000, 9.70331> ); llSetLocalRot( <-0.00000, 0.81563, -0.00000, -0.57857> ); }
Basically I'm trying to get a hatch to rotate aprox 20 degrees. I THINK the above numbers should give everything needed, but clueless of where to start Thanks!
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-03-2005 17:39
From: Spuds Milk The wiki says you can do it by multiplying a vector for the offset that you want the rotation center to be, but I odn't understand what they mean. To have something move 20 meters along an object's local X-axis: vector local = <20,0,0> * llGetRot(); So for example, stick your rotation and offset values in for you want the object to behave. Note that you can also kick the rotation system in reverse with division (useful for stuff you want to "open," like an iris) - vector local = <20,0,0> / llGetRot(); ... and this will yield the same value as the first block: rotation rot = llGetRot(); rot.s = -1; vector local = <20,0,0> / rot; Try it! 
_____________________
---
|
Spuds Milk
Registered User
Join date: 28 Sep 2004
Posts: 94
|
03-04-2005 03:01
got that to work, by removing the rot.s =-1 (it was sending the object into orbet, I think)
Unfortuantly, this isn't what I'm trying to accoblish, I'm trying to get the 10m box to pivit on one edge, ala a door. It gets more complicated in that it's linked to many other objects
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-04-2005 07:53
From: Spuds Milk Unfortuantly, this isn't what I'm trying to accoblish, I'm trying to get the 10m box to pivit on one edge, ala a door. It gets more complicated in that it's linked to many other objects Okay. That's a bit easier. Say you have your 10m door, with the right side (+ X axis) as your pivot edge and the Z axis as the axis you want to rotate around. vector pivot_point = <0,0,0> // Example pivot point rotation rot; // Sample rot; initialization only! rotation initial_rot; // Initialization only!
default { state_entry() { initial_rot = llGetRot(); rot = llEuler2Rot(<0,0,PI_BY_TWO>); // Because I don't remember the Quat offhand } touch_start(integer total_number) { if(llGetRot() == initial_rot) // If we're here... { llSetRot(rot * llGetRot()); // Note that order does matter here. Multiply the two rots to get // the result of a turn from llGetRot() by } else llSetRot(initial_rot);
llSetPos(pivot_point + (<-5,0,0> * llGetRot()); // Same as what I did before. Note the "-5" is to put your door // five units left of center, or the pivot on the positive-X edge. } } Note an easier way to do this would be to just use cut to make one (or two) 5m boxes, then have them pivot along their center. Note also that I wrote that out of world, so it may not be perfect.
_____________________
---
|