llSetForce() doesn't move avatar in touch_end() handler.
tracked
Dreg2 Rossini
I'm creating a HUD button to float an avatar. When I use llSetForce() in the touch_end() handler the avatar doesn't move. However it works in a touch_start() handler.
Version 1:
default
{
touch_start(integer total_number)
{
llSetForce(<0.0, 0.0, llGetMass() * 10.0>, TRUE);
llSay(0, "Force = " + (string)llGetForce());
llSetTimerEvent(5.0);
}
timer()
{
llSetTimerEvent(0.0);
llSetForce(<0.0, 0.0, 0.0>, TRUE);
}
}
Version 2:
default
{
touch_end(integer total_number)
{
llSetForce(<0.0, 0.0, llGetMass() * 10.0>, TRUE);
llSay(0, "Force = " + (string)llGetForce());
llSetTimerEvent(5.0);
}
timer()
{
llSetTimerEvent(0.0);
llSetForce(<0.0, 0.0, 0.0>, TRUE);
}
}
Version 1 works every time. Version 2 will not move the avatar. The force from llGetForce() is identical in both versions.
Interesting observation: Version 2 works when I have a Cann!bal Ass Spanker 2022 v1.01 attached.
Log In
Maestro Linden
marked this post as
tracked
Maestro Linden
Hi Dreg, I can reproduce this issue, and see a similar report of this phenomenon from 2013. The bug I see is that (reported back then) is that
llSetForce()
fails in an attachment if the agent is not in an "active" state. An agent gets into an active state if they:- Are currently walking/moving
- Have very recently touched any object (whether the HUD object or some other object in-world)
- Have recently been touched by another agent
You can see this with your test scripts in a few ways:
- "Version 1" causes the avatar to float upward if the avatar is walking when touching the script
- "Version 1" causes the avatar to float upward if touching the script very quickly (not holding down the mouse button)
- "Version 1" causes the avatar to float upward if another user touches the avatar immediately before the scripted object is touched
- "Version 2" fails to cause the avatar to float when the avatar is otherwise idle and llSleep(5)is called before thellSetForce()call
Maestro Linden
marked this post as
under review