hi all,
How can i store the x, y and z-position of a prim.
Let's say: if someone is placing a prim the way they want i need to store that so they can reset it when they touch another object.
thanx
These forums are CLOSED. Please visit the new forums HERE
store x,y and z postion of one prim |
|
|
Asjbak Vandeverre
Registered User
Join date: 25 Dec 2006
Posts: 14
|
11-22-2007 07:31
hi all,
How can i store the x, y and z-position of a prim. Let's say: if someone is placing a prim the way they want i need to store that so they can reset it when they touch another object. thanx |
|
Kahiro Watanabe
Registered User
Join date: 28 Sep 2007
Posts: 572
|
11-22-2007 07:50
CODE
More information: http://lslwiki.net/lslwiki/wakka.php?wakka=llGetPos |
|
Asjbak Vandeverre
Registered User
Join date: 25 Dec 2006
Posts: 14
|
11-22-2007 14:39
thanx kahiro, that helped me a lot...but.....
I looked at llGetPos() and llSetPos(). llSetPos() wil move the prim to the specified location. llGetPos() will get the coordinates from the current postion. (same as getRot() and SetRot()) Maybe I was wrong with my question..... I want to move my prim....set that specific coordinates and set them to standard (store them) from that moment, when i move my prim, i want the ability to place it back to the point that was stored. So how do i save the llGetPos() (or GetRot) somewhere? |
|
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
|
11-22-2007 15:02
After rezzing the object and placing it in it's 'start' position, you can use a simple 'touch' to store the start co-ords in a global vector...
touch_start(integer total_number) { //stores the start position in global vector StartPos on touch StartPos = llGetPos(); llInstantMessage(llGetOwner(),"The start position for the " + llKey2Name(llGetKey()) + " has been set to " + (string)StartPos); } when you want it to return to the 'start' position use llSetPos(StartPos) |
|
Asjbak Vandeverre
Registered User
Join date: 25 Dec 2006
Posts: 14
|
11-22-2007 15:43
Hi Debbie,
o so simple....but many thanx. Sometimes I'm thinking too much lol. I've got it working the way you said ![]() |
|
Asjbak Vandeverre
Registered User
Join date: 25 Dec 2006
Posts: 14
|
11-23-2007 12:55
mmmm,
now i've the same problem with rotation llgetRot() and llsetRot() don't work ![]() i'm trying things as vector StartRot = llEuler2Rot( StartRot * DEG_TO_RAD ); but i can't get it to work ![]() same question: how can i set and get the rotation of a prim? |
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-23-2007 21:14
mmmm, now i've the same problem with rotation llgetRot() and llsetRot() don't work ![]() i'm trying things as vector StartRot = llEuler2Rot( StartRot * DEG_TO_RAD ); but i can't get it to work ![]() same question: how can i set and get the rotation of a prim? I'll assume you want the setting to be done in degrees? you were close, but you used the wrong call... a vector stores the euler.. so you wanted what I have below vector vVecFriendly = llRot2Euler( llGetRot() ) * RAD_TO_DEG; gives you x/y/z as an axis rotation in deg to avoid confusion of local vs global rotation, do all your changes/math on the vector, then call llSet( llEuler2Rot( vVecFriendly * DEG_TO_RAD ) ); _____________________
|
| . "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... | - |
|
Asjbak Vandeverre
Registered User
Join date: 25 Dec 2006
Posts: 14
|
11-24-2007 09:27
Hi VOid,
Thanx for the reply. My savepoint is working now: vector StartRot = llRot2Euler( llGetRot() ) * RAD_TO_DEG; but when I want to restore my savepoint it always is placed to 0,0,0: llSetRot( llEuler2Rot(StartRot * DEG_TO_RAD)); what's wrong with it? edit: even when I try to get the stored number i get 0,0,0 (???): llInstantMessage(llGetOwner(),"temp from " + llKey2Name(llGetKey()) + " is " + (string)StartRot); EDIT2: Got it ![]() had to use: StartRot = llRot2Euler( llGetRot() ) * RAD_TO_DEG; instead of: vector StartRot = llRot2Euler( llGetRot() ) * RAD_TO_DEG; and at start of script : vector StartRot; ![]() ![]() Many thanx |