REZ_ACCEL option of llRezObjectWithParams() has no effect
tracked
Ratany Resident
The rezzed object doesn't seem to get accelerated. The wiki page has omitted information about what 'force' actually means and, for example, doesn't say how a force that would accelerate the object by N meters per second would need to be calculated.
Log In
Maestro Linden
tracked
Maestro Linden
I did some more digging, and added a script to the rezzed object which reports llGetAccel() both on initial rez and then a bit later. I see 2 bugs here:
- llGetAccel() called immediately in on_rez() reports <0,0,0>, when in fact the object is already in acceleration
- llGetAccel() called 1-2 seconds after rez reports an acceleration of <0, -7.63926, 0>. This agrees with the estimated acceleration of the object's sampled velocity, but does not align with the REZ_ACCEL parameter of <0,-5,0>. Digging further, I see that llGetMass() in my default 50cm sphere is 0.654499, and -5/-7.63926 = 0.654499. So REZ_ACCEL isn't setting the actual acceleration of the object in m/s^2, it's instead specifying some sort of accelerating _force_ that accelerates objects with mass <1.0 too much and objects with mass >1.0 less than what was specified.
I'm importing this issue based on bug (2), and plan to file a separate bug for llGetAccel() reporting ZERO_VECTOR when called immediately in on_rez().
Maestro Linden
needs info
Maestro Linden
Ratany Resident how are you measuring acceleration?
I tried a basic setup, rezzing a 50cm sphere set to 0 gravity with an initial acceleration, using this script:
default
{
touch_start(integer total_number)
{
vector vel = <2, 0, 0>;
vector accel = <0,-5,0>;
integer param = 5;
llSay(0, "Rezzing with vel " + (string)vel + " and accel " + (string)accel);
llRezObjectWithParams("ball", [
REZ_POS, <0,0,1>, TRUE, FALSE,
REZ_ROT, ZERO_ROTATION, TRUE,
REZ_FLAGS, REZ_FLAG_TEMP | REZ_FLAG_PHYSICAL | REZ_FLAG_DIE_ON_COLLIDE | REZ_FLAG_BLOCK_GRAB_OBJECT,
REZ_VEL, vel, TRUE, FALSE,
REZ_ACCEL, accel, TRUE,
REZ_PARAM, param
]);
}
object_rez(key id)
{
llResetTime();
vector vel1 = llList2Vector(llGetObjectDetails(id, [OBJECT_VELOCITY]), 0);
llOwnerSay("vel on rez is " + (string)vel1);
llSleep(1);
vector vel2 = llList2Vector(llGetObjectDetails(id, [OBJECT_VELOCITY]), 0);
llOwnerSay("vel 1 second later is " + (string)vel2);
llOwnerSay("object acceleration approximately " + (string)((vel2 - vel1)/llGetAndResetTime()));
llSleep(1);
vector vel3 = llList2Vector(llGetObjectDetails(id, [OBJECT_VELOCITY]), 0);
llOwnerSay("vel 2 seconds later is " + (string)vel3);
llOwnerSay("object acceleration approximately " + (string)((vel3 - vel2)/llGetTime()));
}
}
While llGetAccel() in the rezzed object returns <0,0,0> on rez (which definitely seems to be a bug), the object is definitely accelerating in the direction specified by REZ_ACCEL; the script's output is:
vel on rez is <2.00000, -1.18835, 0.00000>
vel 1 second later is <2.00000, -8.82771, 0.00000>
object acceleration approximately <0.00000, -7.47296, 0.00000>
vel 2 seconds later is <2.00000, -16.46707, 0.00000>
object acceleration approximately <0.00000, -7.63802, 0.00000>
It would appear that for this particular object, the acceleration is in fact approximately 50% higher than what was specified in REZ_ACCEL (<0,-5,0>).