Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

[BUG-228399] Script deletion disables vehicle controls until re-rez #6499

Open
3 tasks
sl-service-account opened this issue Mar 29, 2020 · 5 comments
Open
3 tasks

Comments

@sl-service-account
Copy link

sl-service-account commented Mar 29, 2020

When a user or update script replaces a vehicle script (rather than resetting the script), that prim can no longer use vehicle physics it is taken and re-rezzed

Steps to reproduce:

  1. add the attached script "simple car" to a cube

  2. sit on the cube. you should be able to drive it. Stand back up when done

  3. delete "simple car" from the cube

  4. add "simple car" back into the cube

  5. sit on the cube again. It is no longer drivable (expected behavior: it is still drivable)

  6. pick up the cube, and re-rez it

  7. sit on the cube again. It is now drivable again

    If you replace steps 3-4 with "reset the script", the bug does not appear

    Other information

    We discovered this bug while using the Teeglepet updater, which deletes and replaces the scripts and animations with a new version (Teeglepet is a ridable animesh horse, and includes vehicle physics). Customers suddenly began reporting this problem around 2020-03-15, This was unexpected, as none of the scripts had changed since January. We suspect this bug was introduced in a simulator update deployed sometime in March 2020. (I cannot confirm this, as I have no access to older simulator versions)

Attachments

Links

Related

Duplicates

Original Jira Fields
Field Value
Issue BUG-228399
Summary Script deletion disables vehicle controls until re-rez
Type Bug
Priority Unset
Status Accepted
Resolution Accepted
Reporter Tapple Gao (tapple.gao)
Created at 2020-03-29T08:02:34Z
Updated at 2021-05-03T19:59:15Z
{
  'Build Id': 'unset',
  'Business Unit': ['Platform'],
  'Date of First Response': '2020-03-29T15:31:21.062-0500',
  'ReOpened Count': 0.0,
  'Severity': 'Unset',
  'System': 'SL Simulator',
  'Target Viewer Version': 'viewer-development',
  'What just happened?': 'vehicle physics no longer engage until I re-rez the prim',
  'What were you doing when it happened?': 'I deleted a vehicle script from a prim, and re-added another copy of the same script. This issue does not appear if I simply reset the script',
  'What were you expecting to happen instead?': 'Steps to reproduce:\r\n1. add the attached script simple-vehicle to a cube\r\n2. sit on the cube. you should be able to drive it. Stand back up when done\r\n3. Delete simple-vehicle from the cube\r\n4. add simple-vehicle back into the cube\r\n5. sit on the cube again. It is no longer drivable\r\n6. pick up the cube, and re-rez it\r\n7. sit on the cube again. It is now drivable again\r\n\r\nThe bug is that, if you replace reproduction steps 3-4 with "reset the script", step 5 is as expected (the vehicle is drivable)',
}
@sl-service-account
Copy link
Author

Tapple Gao commented at 2020-03-29T15:05:48Z

I checked the release notes for the simulator version running at Teegle sim: https://releasenotes.secondlife.com/simulator/2020-03-17T20%3A08%3A11.538605.html

"Fixes for object_rez timing in scripts" sounds like it might be related to this vehicle initialization on rez bug

@sl-service-account
Copy link
Author

Teager commented at 2020-03-29T20:31:21Z

The first reported case of this bug came in somewhere between March 5th and March 10th. Second and third cases were reported on March 12th and 13th. And as of today we've found that the bug reliably reproduces using the steps Tapple mentioned above.

 

The last version of our updater, released in January, previously resulted in the horse deleting and reinstalling its vehicle script, then wandering away as expected. Now using the same updater results in the horse falling over like a regular physical object

@sl-service-account
Copy link
Author

Maestro Linden commented at 2020-03-30T18:05:07Z

Thanks for the report. After reproducing the bug, I added a few lines of debug logging to the script to see where it's failing:

vector fwd_vel = <16,0,0>;
vector left_vel = <0,0,-4>;

default {
    control(key id, integer level, integer edge) {
        if(level & CONTROL_FWD) {
            llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, fwd_vel);
        } else if(level & CONTROL_BACK) {
            llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, -1.0 * fwd_vel);
        } else {
            llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, ZERO_VECTOR);
        }

        if(level & (CONTROL_RIGHT|CONTROL_ROT_RIGHT)) {
            llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, left_vel);
        } else if(level & (CONTROL_LEFT|CONTROL_ROT_LEFT)) {
            llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, -1.0 * left_vel);
        } else {
            llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, ZERO_VECTOR);
        }
    }

    changed(integer change) {
        if (change & CHANGED_LINK) {
            key agent = llAvatarOnSitTarget();
            if (agent) {
                llOwnerSay("Agent sat on me - requesting controls permission and enabling physics.");
                llRequestPermissions(agent, PERMISSION_TAKE_CONTROLS);
                llSetStatus(STATUS_PHYSICS, TRUE);
            } else {
                llOwnerSay("Agent stood up - releasing controls and disabling physics");
                llReleaseControls();
                llSetStatus(STATUS_PHYSICS, FALSE);
            }
        }
    }

    on_rez(integer a) {
        llResetScript();
    }

    state_entry() {
        llSitTarget(<0.6,0,0.7>, ZERO_ROTATION);
        llSetCameraEyeOffset(<-6.0, 0.0, 2.0>);
        llSetCameraAtOffset(<2.0, 0.0, 1.0>);
        llSetVehicleType(VEHICLE_TYPE_CAR);
    }

    run_time_permissions(integer perm) {
        llOwnerSay("run_time_permissions triggered with perm = " + (string)perm);
        if (perm) {
            llTakeControls(
                CONTROL_FWD | CONTROL_BACK |
                CONTROL_RIGHT | CONTROL_LEFT |
                CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT |
                CONTROL_UP | CONTROL_DOWN, TRUE, FALSE);
        }
    }
}

In step (5), the script detects that the user sat, enables physics successfully, and gets PERMISSION_TAKE_CONTROLS successfully. The problem seems to be that llTakeControls() is failing to failing to cause any controls to be bound.

@sl-service-account
Copy link
Author

Tapple Gao commented at 2020-03-31T14:33:53Z, updated at 2020-03-31T15:17:32Z

I added another attachment (simple car debug) with Maestro's llOwnerSay commands, and also hovertext in the control event. llTakeControls seems to work for me; I delete the script, re-add, sit, and then press arrow keys. The hovertext reports the keypresses as expected, but the vehicle doesn't drive.

Also, try performing this test on a hill. The vehicle will just slide or roll down the hill out of control on sit after delete/re-add

@sl-service-account
Copy link
Author

Rider Linden commented at 2020-04-08T22:01:11Z

There is a workaround for the time being.  Modify the changed event as follows:

 

    changed(integer change) {
        if (change & CHANGED_LINK) {
            key agent = llAvatarOnSitTarget();
            if (agent) {
                llSetVehicleType(VEHICLE_TYPE_CAR);
                llOwnerSay("Agent sat on me - requesting controls permission and enabling physics.");
                llRequestPermissions(agent, PERMISSION_TAKE_CONTROLS);
                llSetStatus(STATUS_PHYSICS, TRUE);
            } else {
                llSetVehicleType(VEHICLE_TYPE_NONE);
                llOwnerSay("Agent stood up - releasing controls and disabling physics");
                llReleaseControls();
                llSetStatus(STATUS_PHYSICS, FALSE);
            }
        }
    }

Note that we are setting the vehicletype to car as the agent sits down and then changing it to none when they stand up.

 

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant