Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llMoveToTarget and llTargetOmega Tweaks

Feynt Mistral
Registered User
Join date: 24 Sep 2005
Posts: 551
02-09-2006 23:15
Love them both, really I do. Smooth movement which if attempted any other way is jerky at best. However working on some recent projects in world I've come to lament the lack of certain features in both:

llMoveToTarget:
The range is, sadly, too small for some of my would be applications (a cross sim transit system). I believe last tested it goes just short of 65 meters. I'd like this increased to 128 meters, or preferably the full sim length. I fully support a cap on the speed at which an object can travel as a result of this function to the current speed possible with max distance and min-tau to prevent instant warping or not-quite-but-close-to-faster-than-light vehicles ( o.o; ).

llTargetOmega:
I like that it's client animated for smoothness, I don't like that it's only "simulated" rotation. I request a cousin version of this that allows smooth rotation by a particular angle. As far as the server's concerned it's just like an llSetRot, but client side the rotation is rendered. This would greatly smooth out the rotation of one of my latest creations (a recreation of a staff with a top that flips up). A local version of llMoveToTarget wouldn't hurt here either so I can move the prims between positions rather than setting them in their new spot. >.>;


Addendum:
In my infinite boredom (re: enlightenment) I managed to make an all-range llMoveToTarget script. But I'd still rather have the actual ll command modified.
CODE

integer targetMove = 0;
integer going = TRUE;
vector destPos = <x1, y1, z1>; // Alter these to suit your needs
vector startPos = <x2, y2, z2>; // These too

moveAtTarget(vector destination, float tau) {
if (llVecDist(llGetPos(), destination) > 64) {
vector tempTarget = destination;
integer counter = 10;
while (llVecDist(llGetPos(), tempTarget) > 64 && counter > 0) {
--counter;

tempTarget = llGetPos() + ((tempTarget - llGetPos()) / 1.5);
}
targetMove = llTarget(tempTarget, 32);
llMoveToTarget(tempTarget, tau);
} else {
targetMove = llTarget(destination, 1);
llMoveToTarget(destination, tau);
}
}

default {
state_entry() {

llSitTarget(<0,0,0.1>, ZERO_ROTATION);
llSetStatus(STATUS_PHYSICS, FALSE);
llSetStatus(STATUS_PHANTOM, TRUE);
llSetStatus(STATUS_ROTATE_X|STATUS_ROTATE_Y|STATUS_ROTATE_Z, FALSE);
while (llVecDist(llGetPos(), startPos) > 0.001) llSetPos(startPos);
}

at_target(integer tNum, vector targetPos, vector ourPos) {
llTargetRemove(targetMove);
if (targetPos == destPos) {
llStopMoveToTarget();
llUnSit(llAvatarOnSitTarget());
moveAtTarget(startPos, 0.1);
going = FALSE;
} else if (targetPos == startPos) {
llStopMoveToTarget();
llSetStatus(STATUS_PHYSICS, FALSE);
llSetPos(startPos);
going = TRUE;
} else if (going) {
moveAtTarget(destPos, 1);
} else if (!going) {
moveAtTarget(startPos, 0.1);
}
}

// Slightly altered portion of llAvatarOnSitTarget() example
changed(integer change) { // something changed
if (change & CHANGED_LINK) { // and it was a link change
if (llAvatarOnSitTarget() != NULL_KEY) { // somebody is sitting on me
llSetStatus(STATUS_PHYSICS, TRUE);
moveAtTarget(destPos, 1);
}
}
}
}
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
02-10-2006 09:18
I can help on that llTargetOmega() request. I wrote and released a script awhile back that does the math for you to let you rotate an object smoothly a certain number of degrees around an axis. It calls llTargetOmega(), sleeps a precise amount of time, and then calls llSetRot(). While it's maybe not QUITE what you wanted since the llSetRot() happens after the end of the rotation, I think it'll work for you.

/54/31/69230/1.html
Feynt Mistral
Registered User
Join date: 24 Sep 2005
Posts: 551
02-10-2006 11:15
If it works, it works. But again it'd still be nice if this kind of thing was implemented as an ll function.

I'd also enjoy a means of rotating around an arbitrary point, but a friend and I worked on a script to do that. The movement is jerky (rotation in particular, hence my request for the llTargetOmega clone), but it still works. If a Linden out there would like to implement the rotation script I've got as an ll function (llRotAtPoint(rotation rot, vector localPoint)) so it can do both an llSetPos and an llSetRot at once without horrendous movement lag, I'd be happy to submit it.
Zepp Zaftig
Unregistered Abuser
Join date: 20 Mar 2005
Posts: 470
02-10-2006 20:47
If the object is physical, llTargetOmega does actual rotation.
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
02-11-2006 10:38
You can do llSetPos and llSetRot at the same time using llSetPrimitiveParams. I believe someone may have implemented the same thing you did in this thread:

/15/f5/33104/1.html