Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

avatar moving problem

Cerise Sorbet
Registered User
Join date: 8 Jun 2008
Posts: 254
04-16-2009 18:06
Small targets are hard for avatars, avatars move sloppy. Try to make zee higher so the avatar can float in, add half a meter or even less. llApplyImpulse could work better, llPushObject if you want it to work when you are hovering.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-16-2009 18:17
Rough and needs to be cleaned up but it gets it to the target range:

CODE

integer targetid;
vector startpos;
vector stoppos;
float speed = 2.5;
vector target;
float zee;
default {
state_entry() {
startpos = llGetPos();
stoppos = <10, 10, 0 >;
}
touch_start(integer total_number) {
if (llGetOwner() == llDetectedKey(0)) {
llSetTimerEvent(15.0); //safety
target = startpos + stoppos;
llOwnerSay((string) target);
// targetid = llTarget(stoppos, 1.0);
llMoveToTarget(target, speed);
}
}
at_target(integer number, vector outtarget, vector ourpos) {
llTargetRemove(number);
llMoveToTarget(target, 0.3);
llSetTimerEvent(0.3);

}
timer() {
llStopMoveToTarget();
stoppos *= -1;
llSetTimerEvent(0.0);
// if (target == <21.0, 71.0, zee >) {
// stoppos = <30.0, 73.0, zee >;
// }
// else {
// stoppos = <21.0, 71.0, zee >;
// }
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-16-2009 18:22
From: Cerise Sorbet
Small targets are hard for avatars, avatars move sloppy. Try to make zee higher so the avatar can float in, add half a meter or even less. llApplyImpulse could work better, llPushObject if you want it to work when you are hovering.


Thanks, Cerise. Yes, I've noticed the sloppiness. I'm puzzled though by the fact that this script is NOT sloppy if I'm headed in one direction but IS if I'm headed the opposite one. Just to see exactly what progress I'm making, I added a not_at_target event with llOwnerSay((string)llGetPos()) in it. If the target is <21.0,71.0,zee> I approach it nicely and always end up within 0.05m of the target. If the target is <30.0,73.0,zee> I always end up at <29.0, 72.0, zee> +/- 0.05m. That makes no sense to me.

To elaborate on my other question, if I set the range on llTarget to <1.0, the script moves me to something close to <21.0, 71.0, zee> but not close enough to trigger the at_target event, so the script hangs up. That means that it never gets to the llStopMoveToTarget call, never resets stoppos, and won't respond to another touch_start. Again, that makes no sense to me.

I know there are other ways to write the script that will move the avatar between the target points, using llApplyImpulse or whatever, but I'm really curious about how this particular method works, or (really) why it doesn't behave well as I've written it.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-16-2009 18:31
I am confused thou after going back and reading the whole thread. Does the OP really understand that she can just tp there instantly using warpPos or even in hops calling llSetPos in a loop, either of which would be much more elegant?
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-16-2009 18:37
From: Jesse Barnett
I am confused thou after going back and reading the whole thread. Does the OP really understand that she can just tp there instantly using warpPos or even in hops calling llSetPos in a loop, either of which would be much more elegant?


I am too. I suggested warpPos way back in the beginning of this thread (post #4), but the OP seems to ignored that and gone off in this direction. Right now, I don't truly care what works best for the OP as much as I did at first. Since I got myself sucked into playing with the OP's script, I'm really curious about why it behaves so strangely. When a script doesn't do what I expect it to, I'd kinda like to know why. ;)
Cerise Sorbet
Registered User
Join date: 8 Jun 2008
Posts: 254
04-16-2009 18:40
Physical is the only way to go if you can't rez and it looks more cool.

Rollig, I think you got lucky in one direction. llMoveToTarget damps down and fights the avatar near the target. Better results might come with a slow walk to a big target and then a fast leap to a small target at the end.

I see Jesse cheated and took out llTarget and that can work too ;)
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-16-2009 18:54
From: Cerise Sorbet
Physical is the only way to go if you can't rez and it looks more cool.

Rollig, I think you got lucky in one direction. llMoveToTarget damps down and fights the avatar near the target. Better results might come with a slow walk to a big target and then a fast leap to a small target at the end.

I see Jesse cheated and took out llTarget and that can work too ;)


Dang! I hate luck. :p It's too unpredictable. I do like Jesse's workaround, though. I just tested it myself and it does the job. I haven't fiddled with enough scripts like this to feel comfortable yet, so I truly appreciate the help. This is a nice learning exercise.

BTW ..... maybe I'm pressing my luck(?) by asking, but I'm still interested in knowing how to get myself facing toward the target as the script moves me.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-16-2009 18:57
From: Rolig Loon
I am too. I suggested warpPos way back in the beginning of this thread (post #4), but the OP seems to ignored that and gone off in this direction. Right now, I don't truly care what works best for the OP as much as I did at first. Since I got myself sucked into playing with the OP's script, I'm really curious about why it behaves so strangely. When a script doesn't do what I expect it to, I'd kinda like to know why. ;)

I am still playing with it also for the same reason, but maybe not much longer. The combo of Havok 4/MONO just really screwed up target and apply impulse in attachments. I have a Set Elevation script that worked beautifully before then. Set target height and boom you were up at 10,000 meters. It doesn't even work right for little hops of a hundred meters or so anymore. I've been disgusted since then.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-17-2009 18:17
This prompted me to go back and take a look at my existing problem with my Elevation Script for a couple of hours last night. I discovered something that may be the root of your problem Rolig.

CODE

float height = 4090.0;
integer safetyCnt;
vector target;

default {
touch_start(integer total_number) {
target = llGetPos();
target.z = height;
llTarget(target, 50);
safetyCnt = 1;
llSetTimerEvent(45.0);
}

not_at_target() {
llApplyImpulse(llGetMass() * <0, 0, 20000>, FALSE);
}

at_target(integer targetInt, vector targetPos, vector currentPos) {
llTargetRemove(targetInt);
llMoveToTarget(targetPos, 0.2);
safetyCnt = 0;
llSetTimerEvent(2.0);
}

timer() {
++safetyCnt;
vector pos = llGetPos();
if (llVecDist(pos,target)<=.1 || safetyCnt == 2) {
llStopMoveToTarget();
llApplyImpulse(-llGetMass() * llGetVel(), FALSE);
llMoveToTarget(llGetPos(), 0.1);
llSetBuoyancy(1.0);
llOwnerSay((string)llGetPos());
llSetTimerEvent(0.0);
}
llOwnerSay((string)safetyCnt);
}
}

*NOTE* You will have to reset the script when you fly or teleport back to the start position because of llSetBuoyancy.


This works fine if YOU ARE NOT FLYING when you click it. You flail around and it brings you within 1/10th of a meter of target.
[17:50] Object: <83.00000, 20.00000, 4089.94600>
[17:50] Object: 1
BUT if you try the same experiment when you are hovering. More then 50% of the time you have to nudge your av by pushing the Page Up button to start moving and the resulting stop pos is considerably different:
[17:56] Object: 1
[17:56] Object: <82.99980, 19.99759, 4087.62700>
[17:56] Object: 2
As you can see, you never get within the set target range and instead time out on the safetyCnt. So for some reason an av is "stickie" in some states for the Havok 4 engine.
Please note that this was never a problem in the Havok 1 engine and did not matter if the av was flying. I would not doubt that the same applies for traveling sideways, even when walking for some reason. Havok 4 is fighting the script.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-17-2009 19:24
From: Jesse Barnett

BUT if you try the same experiment when you are hovering. More then 50% of the time you have to nudge your av by pushing the Page Up button to start moving and the resulting stop pos is considerably different:
[17:56] Object: 1
[17:56] Object: <82.99980, 19.99759, 4087.62700>
[17:56] Object: 2
As you can see, you never get within the set target range and instead time out on the safetyCnt. So for some reason an av is "stickie" in some states for the Havok 4 engine.
Please note that this was never a problem in the Havok 1 engine and did not matter if the av was flying. I would not doubt that the same applies for traveling sideways, even when walking for some reason. Havok 4 is fighting the script.

You're not wearing Flight Feather are you? You might be having two different llMoveToTargets fighting each other. I added that after Havok4 was introduced because I couldn't use a feedback loop to keep you hovering cleanly any more.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-17-2009 19:31
From: Argent Stonecutter
You're not wearing Flight Feather are you? You might be having two different llMoveToTargets fighting each other.

Nope. Flight assist is turned off. I rubber band if I try it with flight assist enabled. As I mentioned, I first noticed the change in behavior back in Aditi when Havok 4 was being tested. Before that point, move to target worked exactly the same for either a vehicle or an attachment. And this is different then the cap on impulse. I bet if someone tested Rolig's script in a physical prim, it would work correctly.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Tabliopa Underwood
Registered User
Join date: 6 Aug 2007
Posts: 719
04-17-2009 20:23
From: Rolig Loon
...
1. If I set the range in llTarget to anything less than 1.0, the script doesn't do a thing.
2. When I let the script move me to stoppos = <30.0,73.0,zee>, I get there. When I expect it to take me to stoppos=<30.0,73.0,zee>, it gets me to <29.0,72.0,zee> and thinks I have arrived.

Any guesses why?</QUOTE>

here: targetid = llTarget(stoppos, 1.0);

As written you already within the target. Target being a 1 meter radius centered on your stoppos.

From: someone
Also, it would be most cool if this script let me actually face the stoppos target while I'm walking toward it. I'm new at this sort of problem, so I'm not sure how to do that. Help? :confused:[/QUOTE

We cant rotate an avatar in LSL unless they sit on something. Be good if we could like you say.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-17-2009 20:39
From: Tabliopa Underwood
here: targetid = llTarget(stoppos, 1.0);

As written you already within the target. Target being a 1 meter radius centered on your stoppos.

That's the problem.
From: Rolig Loon
...
1. If I set the range in llTarget to anything less than 1.0, the script doesn't do a thing.

From: Tabliopa Underwood
We cant rotate an avatar in LSL unless they sit on something. Be good if we could like you say.

Haven't had a chance to play with it today. Since it is an attachment, wondering if llLookAt or llRotLookAt will work.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Tabliopa Underwood
Registered User
Join date: 6 Aug 2007
Posts: 719
04-17-2009 20:52
From: Jesse Barnett
. Since it is an attachment, wondering if llLookAt or llRotLookAt will work.


Unfortunately no. You can rotate the attachment to face the way you want but not an avatar itself, including your own. I understand why in the case with someone elses avatar but I think you should be allowed to do this to your own. After all can llPush..(yourself) or llMove..(yourself) anywhere so being able to also face the direction youre pushing/moving yourself would be good also.

Is a JIRA asking for this feature. Dont remember exactly which one though.
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
04-17-2009 20:59
https://jira.secondlife.com/browse/SVC-2697 for anyone who wants the flight problem fixed.

Adding to the fun, even with identical sets of attached scripts, I can see the problem with one avatar but not with two others.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-17-2009 21:24
Thanks Viktoria. I will vote and comment on it tomorrow. Can't believe no one else had noticed it before then, but then again, I was always too busy (or lazy) to pursue it till now. It was not a bug introduced into any particular server version, but dates back to the changeover in Havok. But it was when jira was first getting off the ground and I just filed an old fashioned bug report.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-18-2009 04:04
The avatar rotation problem is due to the way avatar rotation is derived second-hand by looking at what the client is doing. Most of the time your avatar will appear to be facing different directions on different people's screens, unless you have just finished walking directly forward or backwards without turning.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-18-2009 08:33
Thank you, all. This has been a great puzzle and a learning experience. I have no idea whether the OP has gained anything from it, but I liked playing with it and appreciate the insights you have offered. :D
1 2