Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Finding Direction?

LIO Diesel
Registered User
Join date: 2 Sep 2008
Posts: 28
12-16-2008 03:26
Hi,

I am stucked with the problem explain below....
I had a sphere. when iused llGetVel() function it returns values in x,y,z in negative and positives.
What i want is if some avatar is collide with sphere, i want to move the prim accordigly opposite direction so that it looks like somone is hitting the ball.
I want to find the exact direction if the avatar.

give some ideas regarding this.???????
Thanks.
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
12-16-2008 03:39
llDetectedVel() is what you are looking for.

http://www.lslwiki.net/lslwiki/wakka.php?wakka=llDetectedVel

hth
/esc
_____________________
http://slurl.com/secondlife/Together
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
12-16-2008 07:42
And or llDetectedPos() during a collision event for the position of the colliding avatar or object, with llGetPos() subtracted to make it an offset from the prim's current position.
LIO Diesel
Registered User
Join date: 2 Sep 2008
Posts: 28
12-17-2008 05:32
Hi hewee & Escort,
Thanks for reply.I am mentioning my code here whichis written in the collision event.

collision(integer total_number)
{
V=llDetectedVel(0);

//llOwnerSay( ""+(string)V);
if(V.x>0 && V.y>0)
{llSetPos(llGetPos()+<-V.x,-V.y,0>;);jump end;}

if(V.x<0 && V.y<0)
{llSetPos(llGetPos()+<V.x,V.y,0>;);jump end;}

if(V.x>0 && V.y<0)
{llSetPos(llGetPos()+<-V.x,V.y,0>;);jump end;}

if(V.x<0 && V.y>0)
{llSetPos(llGetPos()+<V.x,-V.y,0>;);jump end;}

@end;
}
I want it to go opposite direction from where the avatar is coming.

Suggest Something.