|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
11-04-2008 05:11
and failing miserably...
How would I go about positioning a cube so it's standing on one corner with the opposing corner directly above it on the z axis? That is, if I then make a drag copy by dragging upwards, I'll end up with a prim pivoting on the corner of the other one, with the blue z axis line running directly upwards through the corners, if that makes sense?
|
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
11-04-2008 07:22
I would take the vector pointing through the center towards one corner: <1,1,1> and find the rotation between that and vertical up: <0,0,1> rotation R = llRotBetween( <1,1,1>, <0,0,1>  ; then set the rotation on the cube: llSetRot( R );
_____________________
From Studio Dora
|
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
11-04-2008 07:53
Thank you so much. I am now trying to understand what the vectors in http://www.lslwiki.net/lslwiki/wakka.php?wakka=llRotBetween&show_comments=0 actually signify, but I am so grateful you've showed me how to get it to work!
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-04-2008 08:48
vector direction is a direction from an assumed center point. imagine a line from the center to the point specified. that will give you a facing.
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
11-04-2008 09:27
Think about a vector as an arrow pointing in space. Two arrows will give you two directions. What you need to rotate one arrow into the other arrows direction is the 'RotBetween'. Basically: a vector has the direction from one point to another and its size is the distance between the points. You may well ague that this implies two points or six coordinates in space! Right: since a vector just describes a direction and a magnitude the same vector can be found anywhere in space and it is equal to the one that has the first point in <0,0,0>. That way we only need three coordinates to describe any vector. Given two points: P=<p.x,p.y,p.z> and Q=<q.x,q.y,q.z> the vector from P to Q is PQ = < q.x-p.x, q.y-p.y, q.z-p.z >, three coordinates all in all 
_____________________
From Studio Dora
|
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
11-04-2008 12:18
Ah.. i think I see now.. in effect, each vector is where the centre of the prim would end up if I told the script to use it for llSetPos(llGetPos() + vector myVector), and llRotBetween then draws an imaginary line between the two and points towards the mid-point of that?
|
|
Ralph Doctorow
Registered User
Join date: 16 Oct 2005
Posts: 560
|
11-04-2008 12:40
For a different explanation, you might want to look at the LSL Portal on the SL wiki. http://wiki.secondlife.com/wiki/Rotation
|