You can use llRot2Fwd, llRot2Up and llRot2Left to adjust.
For example:
llRezAtRoot(llGetInventoryName(INVENTORY_OBJECT,0), llGetPos()-llRot2Fwd(llGetRot())+llRot2Left(llGetRot()),llGetVel(),llGetRot(),llGetStartParamater());
Would (with not a lot of efficiency) rez the first object in inventory 1m to the rear and to the left.
Wiki wiki wiki....
Jansen Miles IM'd me with a modification:
//llRot2Fwd() and it's kin represent a normalization of 1.0. So just multiply that by your actual desired vector components!
default
{
touch_start(integer total_number)
{
//* Rezzed object offset from rezzer center.
vector offset = <0, 0, 0.35>;
llRezObject(llGetInventoryName(INVENTORY_OBJECT,0),
llGetPos() + (llRot2Fwd(llGetRot()) * offset.x) + (llRot2Left(llGetRot()) * offset.y) + (llRot2Up(llGetRot()) * offset.z),
llGetVel(), llGetRot(), llGetStartParameter());
}
}
A slightly better example including Jansen's suggestion:
string inventory_item;
default
{
state_entry()
{
inventory_item=llGetInventoryName(INVENTORY_OBJECT,0); // get the name of the first object in inventory
}
touch_start(integer p)
{
rot=llGetRot();
//a vector is used to represent your offset in terms of fwd/back, left,right, up/down
// eg. <-2,0,1> would be 2m back, 1m up
vector offset=<-2,0,1>;
vector rezpos=llGetPos() + (llRot2Fwd(rot) * offset.x) + (llRot2Left(rot) * offset.y) + (llRot2Up(rot) * offset.z);
llRezAtRoot(inventory_item, rezpos, ZERO_VECTOR, rot, 0);
//ZERO_VECTOR is used instead of a velocity. One *could* use llGetVel if you "rezzer" is moving
//the last "0' is the paramater that will be passed to on_rez in teh rezzed object
}
}
I like the use of the vector for offsets!
No comments:
Post a Comment