Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Better llMoveToTarget()

Mark Busch
DarkLife Developer
Join date: 8 Apr 2003
Posts: 442
04-14-2003 08:59
Hi,

I've noticed that most people try to make an elevator and even IF they work they mostly suck. I've tried about everything with llMoveToTarget and llSetHoverHeight and even apply impulse. The problem seems to be that it collides all the time, even if walls are WAY out of range, and if you stand on it, it just doesn't make it to the target.
IF you choose PHANTUM_STATE then it goes better, but it doesn't work then because it floats trough you...
I know the physics system if pretty advanced, but it defenitly need more work on that area, or some hack to make elevators easier.
Zanlew Wu
Registered User
Join date: 5 Feb 2003
Posts: 112
04-14-2003 09:29
I know this was discussed somewhere in the scripting forum, but basically what is happening is that MoveToTarget tries to determine the "effort" (energy?) to move a physical object to a target, then attempts to do so over a given amount of time. The problem is that as soon as you step on the target, the calculation becomes different, since the platform is now heavier (with you on it), so it will never quite reach the same place as it would unburdened.

I think the suggestion in the Scripting thread was to check the lift's position after a certain time and if it is not there, issue the llMoveToTarget call again, which may help get it where it needs to be.

Also, for what it's worth, empirical experience has taught me that physical objects like lift platforms need to be at least 0.100m away from the next nearest object or they do tend to behave very oddly indeed.
_____________________
In theory, practice and theory are the same thing. In practice, they're not.
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
04-14-2003 10:40
man i am glad someone is reading the stuff i post. ;)

ok so two things. if you want it to make it to the top, put a second script that listens for the same variable, and checks its position, and if it doesn't make it, then have it whisper something, or linke message something that calls the movetotarget again. another way to do it(although i haven't tried it) is to put the movetotarget in a timer function that cycles until it reaches the desired position.

Just out of curiousity, is your elevator colliding with stuff because it is rotating, or is it just colliding for no apparent reason?