Jump to content

Anti-Fall/Flip Robot/Vehicle


Submissa69
 Share

You are about to reply to a thread that has been inactive for 830 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I have a robot that i can sit on (formed of 5 prims) that rotates and moves forward/backward along the Z axis.  It is basically a 1 speed vehicle in that sense.

But - sometimes, if it makes contact with a boundary wall it will "fall over" or "flip entirely over 180 degrees"

To fix it I have to go into EDIT and fix the rotation for X and Y back to Zero.

Is there a way to either always have X and Y rotations always be zero, or a rotation sensor to check for anything "not zero" and make it zero?

Thank you for any pointers.  Scripting is Amazingly fun and I'm brute-forcing trying things for a solution, but so far no success.

Mwuah,  Submissa. 😁

 

 

Link to comment
Share on other sites

Actually There is an easy fix! (I think ,can never say 100% without looking right at the script and build)

Take a look at the (unhelpfully named) llSetStatus() function, particularly the parameters STATUS_ROTATE_*.

If your robot needs to go uphill though, you might need fancy solutions, like raycasting a line below the robot, checking the hit normal, then something like

llSetAngularVelocity(Magnitude*llRot2Euler(llRotBetween(RobotUp,DetectedNormal)),FALSE);
// where RobotUp is something like llRot2Up(llGetRot()); but will depend on your exact build, and
//   Detected Normal is the normal vector recieved from the raycast.
// Magnitude would have to be found by expiramentation, and the 'best' value might change depending 
//   on the timer's frequency.

on a timer.

Edited by Quistess Alpha
use AngularVelocity, not Torque.
  • Thanks 1
Link to comment
Share on other sites

You might also look into the vertical attractor in vehicle functions.

llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 1.0);
llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 0.1);

Will force it upright.

Edited by arton Rotaru
  • Thanks 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 830 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...