Need some newb help with rezzing position and rotation.
|
|
Austin Blackheart
Registered User
Join date: 8 Jan 2009
Posts: 13
|
01-14-2009 07:45
I need some help with this, been pounding my head for like 10 hours. Im sure this is newb stuff but Im not good with the syntax yet. Id like to rez an object infront of me about 7 meters out. Also I want it to rotate according to me. Getrot is in this but does not work. llRezObject(tp_object, llGetPos() + (<1, 0, 1> * llGetRot()), ZERO_VECTOR, ZERO_ROTATION, rez_chan); Any help greatly appreciated 
|
|
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
|
01-14-2009 07:59
From: Austin Blackheart llRezObject(tp_object, llGetPos() + (<1, 0, 1> * llGetRot()), ZERO_VECTOR, ZERO_ROTATION, rez_chan); QUOTE] You have llGetRot in the wrong place  Try llRezObject(tp_object, llGetPos() + (<1, 0, 1> , ZERO_VECTOR, llGetRot(), rez_chan); Its the fourth parameter that handles rotation.
|
|
Austin Blackheart
Registered User
Join date: 8 Jan 2009
Posts: 13
|
01-14-2009 08:59
From: Beverly Ultsch From: Austin Blackheart llRezObject(tp_object, llGetPos() + (<1, 0, 1> * llGetRot()), ZERO_VECTOR, ZERO_ROTATION, rez_chan); QUOTE] You have llGetRot in the wrong place  Try llRezObject(tp_object, llGetPos() + (<1, 0, 1> , ZERO_VECTOR, llGetRot(), rez_chan); Its the fourth parameter that handles rotation. Hrm it gave me a syntax error with the "  " after the + sign. I removed it and it compiled. That does set rotation correctly but now I cannot edit the distance infront of me it should be. The first <1,0,1> Im guessing handles up down left right. Zero vector Ive tryed replacing with the same syntax and cannot get it to respond. If you were trying to set this 7 meters infront of you how would you put it in to this?
|
|
Nexii Malthus
[Cubitar]Mothership
Join date: 24 Apr 2006
Posts: 400
|
01-14-2009 09:02
llRezObject(tp_object, llGetPos() + (<7, 0, 1> * llGetRot()), ZERO_VECTOR, llGetRot(), rez_chan); Read the question beverly, he wanted it to position it 7 metres infront AND rotate it with him, also I doubt he wanted it to give a syntax error with the brackets all messed up like that. llGetRot() will only work here correctly if this is an attachment, is this in an attachment? Edit: From: Austin Blackheart That does set rotation correctly but... - I guess that is a yes, it is an attachment. If it is a seperate object we would need to use a sensor aimed at searching your avatar and use llDetectedRot, as well as perhaps move into vicinity to obey the within 10m llRezObject rule. From: Austin Blackheart The first <1,0,1> Im guessing handles up down left right. Nope, it means < forwards/back , right/left , up/down > so < 7, 0, 1 > means 7m forward and 1m up.
_____________________
 Geometric Library, for all your 3D maths needs. https://wiki.secondlife.com/wiki/Geometric Creator of the Vertical Life Client
|
|
Austin Blackheart
Registered User
Join date: 8 Jan 2009
Posts: 13
|
01-14-2009 09:21
Heres what I have.
llRezObject(tp_object, llGetPos() + <7, 0, 1> , ZERO_VECTOR, llGetRot(), rez_chan);
Now this does summon it 7 meters away from me and always facing the direction my av is facing. Only one problem. Its always summoning it east of me not infront of me.
|
|
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
|
01-14-2009 10:53
From: Nexii Malthus Read the question beverly, he wanted it to position it 7 metres infront AND rotate it with him, also I doubt he wanted it to give a syntax error with the brackets all messed up like that. .[/QUOTE
I did read the quesetion, i assumed that the OP had enough sense about them to realise that if they wanted it 7m away there should be a 7 in the code somewhre, I thought the problem was about the rotation, sorry about the syntax error but i excpect most people, like the op are smart enough to sort them, we cant always be online all the time to check it, some of us have rl jobs as well.
|
|
Austin Blackheart
Registered User
Join date: 8 Jan 2009
Posts: 13
|
01-14-2009 12:06
Its ok Beverly, you did help. The reason I didnt know it was moving out was because it was going east lol. Anyhow working on my last problem. I think what I need is
llRot2Fwd()
But I cant figure out how to get it working. So Im reading up on that. It will all click eventually I hope =)
|
|
Boss Spectre
Registered User
Join date: 5 Sep 2005
Posts: 229
|
01-14-2009 12:14
You do need to rotate the offset vector as well so add that back in.
llRezObject(tp_object, llGetPos() + (<7.0, 0.0, 1.0> * llGetRot()), ZERO_VECTOR, llGetRot(), rez_chan);
If you wish to rez at some other relative rotation, you can add it like this:
llRezObject(tp_object, llGetPos() + (<7.0, 0.0, 1.0> * llGetRot()), ZERO_VECTOR, llEuler2Rot(<0.,0., -90.> * DEG_TO_RAD) * llGetRot(), rez_chan);
~Boss
|
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
01-14-2009 12:17
I love this forum.. I get to learn by trying to solve problems other people post. Try this: vector vVecOffset = <7.0, 0.0, 1.0>; vector myVector = llRot2Fwd(llGetRot()); float myVecMag = llVecMag(vVecOffset); vector myNewVector = myVector*myVecMag; vector vVecCurrentOffset = llGetPos() + myNewVector; llRezObject(tp_object, vVecCurrentOffset , ZERO_VECTOR, llGetRot()*llGetLocalRot(), rez_chan); Seems to work for me with a hud, at least with the hud prim rotated at <0.0,0.0,0.0>.
|
|
Austin Blackheart
Registered User
Join date: 8 Jan 2009
Posts: 13
|
01-14-2009 12:29
Thanks a million Boss! That worked. Im happy I dont have to continually pound my head into a wall. I knew I was missing something there. That makes sence now. The LSL Wiki explinations are all based on math or something which I know this is math but, it doesnt give very good examples. Looking at a gun script for this is not exactly productive.
|