This is very frustrating.
I'm rezzing an object and I want it to only do something when it collides with another object within a certain distance of where it was rezzed.
I thought that I could use llGetPos() to get the start position and then use it again in the collision events to get the end position then calculate the distance with llVecDist(), but for some reason I'm getting ZERO_VECTOR in the on_rez event.
Here's the example script. It tells you the start position, end position and the distance. It will work by just putting it in a physical prim, picking it up and then dropping it.
Can anyone explain why this is happening?
Thanks
vector startPos;
default
{
on_rez(integer start_param)
{
startPos == llGetPos();
llOwnerSay((string)startPos);
}
collision_start(integer num_detected)
{
vector endPos = llGetPos();
llOwnerSay((string)endPos);
float distance = llVecDist(startPos, endPos);
llOwnerSay((string)distance);
}
land_collision_start(vector pos)
{
vector endPos = pos;
llOwnerSay((string)endPos);
float distance = llVecDist(startPos, endPos);
llOwnerSay((string)distance);
}
}
