Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGetPos() in on_rez returns ZERO_VECTOR?

Cerulean Deadlight
Registered User
Join date: 6 May 2007
Posts: 28
12-20-2008 17:36
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);

}


}
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
12-20-2008 18:08
From: Cerulean Deadlight
startPos == llGetPos();

Too many = signs!!
Cerulean Deadlight
Registered User
Join date: 6 May 2007
Posts: 28
12-20-2008 20:56
ah, what a stupid mistake. ha. Thanks
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
12-20-2008 21:33
If it makes you feel better, I stared at it for about 10 minutes before spotting the mistake. :)