Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rezz object relative to direction avatar facing

Celty Westwick
Registered User
Join date: 24 Jun 2006
Posts: 145
05-05-2008 08:17
I'm trying to script a couple of things that involve rezzing an object from a hud or other attachment on the avatar. I have gotten as far as an object rezzing at a location, but it is independent of which direction the avatar is facing at the time.

I need the object to rezz in front of the avatar at regardless which way it is facing at the time.

CODE

integer object_num = 2;
string messageRezz = "Rezz";

default
{
state_entry()
{
}
link_message(integer sender_num, integer num, string str, key id)
{
if ( num == object_num )
{
if( str == messageRezz )
{llSay(0, "'Rezz!'");
llRezAtRoot("rez sphere", llGetPos() + <0.0,1.0,0.0>, <0.0,0.0,0.0>,<0.0,0.0,0.0,1.0>, 0);
llPlaySound("1b951466-39b4-5083-75e4-c3a3ccafc602",1.0);
}
}

} // end of link_message state

}
CODE


Help please :)
Trolane Demonia
Registered User
Join date: 26 Jan 2008
Posts: 150
05-05-2008 08:41
all i had to do was add a few meters to the x value of the vector for positioning the new rez. it always plopped down in front of me .
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
05-05-2008 09:01
Something here may help...

Celty Westwick
Registered User
Join date: 24 Jun 2006
Posts: 145
05-05-2008 09:35
Thanks guys, this works;)

integer object_num = 2;
string messageRezz = "Rezz";
string object = "rezz sphere";//Object in inventory
integer start_param = 10;
rotation rot;

default
{
state_entry()
{
rot = llEuler2Rot(< 0, 90, 90> * DEG_TO_RAD);
}
link_message(integer sender_num, integer num, string str, key id)
{
if ( num == object_num )
{
if( str == messageRezz )
{llSay(0, "'Rezz!'";);
llRezObject(object, llGetPos() + (llRot2Fwd(llGetRot())*1), ZERO_VECTOR, llGetRot(), 0);
llPlaySound("1b951466-39b4-5083-75e4-c3a3ccafc602",1.0);
}

}

} // end of link_message state

}