Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llMoveToTarget and sensor events

Spider Metropolitan
Registered User
Join date: 5 Apr 2005
Posts: 8
07-17-2005 16:08
I'm doing a bit of fiddling with a simulation of a queue of people moving through a series of waypoints with some llMoveToTarget calls.

Something I'm trying to do is keep them spaced a certain distance from each other, but everything I've tried with llSensor and llSensorRepeat doesn't seem to work.

Any thoughts?
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
07-17-2005 20:33
Spaced in what respect?

I think what you're asking for is to have the object "path" between two points at fixed intervals. This is pretty easy with a little vector math:

CODE
vector target = <100,100,100>; // Assume your target point is given
speed = 5; // Speed of movement (number of meters to cross per)
dampening = 0.3; // llMoveToTarget dampening variable


if(llVecMag(target - llGetPos()) > 10) // If we're more than 10 meters from target
{
llMoveToTarget(llGetPos() + (llVecNorm(target - llGetPos()) * speed),dampening);
// Let's break this up a bit.

// We're telling it to move to the original position plus five meters toward the target
// This only happens if we're more than 10 meters away.
}
else llMoveToTarget(target,0.3);
// Otherwise, we just move to it.


For more information on helpful vector math, you can try the following links:
http://secondlife.com/badgeo/wakka.php?wakka=vector
http://secondlife.com/badgeo/wakka.php?wakka=llVecMag
http://secondlife.com/badgeo/wakka.php?wakka=llVecNorm
http://secondlife.com/badgeo/wakka.php?wakka=llVecDist

http://www.euclideanspace.com/maths/algebra/vectors/index.htm
_____________________
---
Spider Metropolitan
Registered User
Join date: 5 Apr 2005
Posts: 8
07-17-2005 21:14
What I'm looking for is a way of having each member of the line check the space in front of it to see if the person in front of it has moved ahead, then move ahead to fill that space.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
07-17-2005 21:18
Oh.

There's a great article on sensor use for that sort of purpose on the wiki. See here:
http://secondlife.com/badgeo/wakka.php?wakka=llSensor

My guess is you would want to play with rotations and sensor params for that. Say... limit the arc a bit and drop it to a certain distance, ya?
_____________________
---
Spider Metropolitan
Registered User
Join date: 5 Apr 2005
Posts: 8
07-17-2005 21:20
I've been doing some investigating, and it looks like llSensor might be behind this.
Spider Metropolitan
Registered User
Join date: 5 Apr 2005
Posts: 8
07-17-2005 21:25
From: Jeffrey Gomez
Oh.

There's a great article on sensor use for that sort of purpose on the wiki. See here:
http://secondlife.com/badgeo/wakka.php?wakka=llSensor

My guess is you would want to play with rotations and sensor params for that. Say... limit the arc a bit and drop it to a certain distance, ya?


I've been spending the last couple of hours tinkering with that... think I'm getting close to something.
Spider Metropolitan
Registered User
Join date: 5 Apr 2005
Posts: 8
07-17-2005 22:42
Success!

Turns out it's easier to scan, then move, rather than scanning while moving.