Jump to content

non-object attachment controlling avatar movement (attachment vehicles)-


Always Stillwater
 Share

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

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

Recommended Posts

Now-adays griefers have ruined much of SL, causing many sims to not allow objects to be rezzed.  not for visitors, and often not for land group members since that group is often given out fairly freely.  One of the big headaches that causes is for vehicles.  if I have a car or bicycle, boat or floatie, plane or hang-glider then I am out of luck on many sims.  I cannot rez my vehicle and hence cannot use it.

Yes, you can have avatar attachments that LOOK like a car or bicycle, but they don't behave properly since they move as your avatar walks-runs-flies etc.

Maybe I have just never encountered a "well-known" solution and if so please enlighten me.

What I seek is to be able to change a simple vehicle (lets say a car for discussion) and have some way to go to a no-rez sim and attach it to my avatar and have it take over avatar movements so i just move in a scripted car-like fashion.  physics would be wonderful, but i would gladly settle for the pre-physics style of scripted incremental (timer-based) movement.  Basically what the attachment vehicle needs to be able to do is:

1. stop normal avatar controlled movements (walk, run, fly, etc)

2. move the avatar in scripted direction (script no using keys instead of avatar) - and yes, i know this movement would be inferior to normal object vehicle movement.

It would not be a work-around for griefer objects since it would ONLY work on the item attached to an avatar present in the sim (same as today) and there would be no way to spawn off multiple objects or have them move independent of the avatar.

IS THERE A SOLUTION? CAN ANYONE POINT ME AT SOME ATTACHMENT-BASED MOVEMENT FRAMEWORK?

 

 

 

 

Edited by Always Stillwater
Link to comment
Share on other sites

There are a few parts of your question that I don't quite follow, but you are describing a basic wearable vehicle.  The script has two fundamental components. 

First, it contains an attached event, which detects when you have added the vehicle to your av's body.  That event's primary function in the script is to request permissions to take control of your avatar and to override your animations as you wear the vehicle, and to release permission to override animations as you detach it . 

The second component is a run_time_permissions event, which receives the request.  It contains a set of llSetAnimationOverride statements that replace your own "stand", "walking", and "running" animations with a custom animation that you provide  -- an animation that makes it look as if you are sitting in the vehicle's driver seat and holding the steering wheel.  The run_time_permissions event also contains a llTakeControls statement that doesn't need to do much except be there and let you use the keyboard arrow keys normally.  It sounds non-intuitive, but having that statement there means that the script will keep running even if you enter an area where the landowner has switched scripts off.

Those two components make it so that you can move the worn vehicle the same way that you would normally make yourself move, using the keyboard arrow keys, but will stop your stand/walk/run animations and make you look like you are driving the vehicle.  The permissions that your script requests in the attached event are granted automatically as soon as you attach the vehicle, so you don't ever get a dialog box that asks you to give permissions explicitly.  As long as the attached event also contains a llResetAnimationOverride statement that restores your default animations when you detach the vehicle,  that's all there is to it.  

This is not an easy script for a beginning scripter to write, but it's not all that complicated either.  You can probably find several freebie scripts in libraries to use as examples, and you can study the LSL wiki for example scripts that show you how the functions and events I describe work.  They should help you turn my  schematic outline into your own code.  You will of course have to find or make the vehicle and find or create the "driving" animation.

Link to comment
Share on other sites

9 hours ago, Rolig Loon said:

... and let you use the keyboard arrow keys normally  ... so that you can move the worn vehicle the same way that you would normally make yourself move, using the keyboard arrow keys.

yes, but if I understand what you are suggesting (in the 2nd part of your answer) then this is what I am trying to avoid, I dont want to use avatar-motion as the vehicle-motion since it is unrealistic (you can turn sharply, single speed, etc).  What I wish could be done is to block avatar-motion and use those arrow-keys to cause scripted motion suitable to a vehicle.

Link to comment
Share on other sites

6 minutes ago, Always Stillwater said:

yes, but if I understand what you are suggesting (in the 2nd part of your answer) then this is what I am trying to avoid, I dont want to use avatar-motion as the vehicle-motion since it is unrealistic (you can turn sharply, single speed, etc).  What I wish could be done is to block avatar-motion and use those arrow-keys to cause scripted motion suitable to a vehicle.

That's the part of your question that I couldn't quite make sense of before.  OK, then, if that's the case, you will need to do some rather tricky scripting.  Once you have PERMISSION_TAKE_CONTROLS, you can  use the arrow keys as controls for a virtual motor.  I suggest taking a long time to read and digest the LSL Vehicle Tutorial, so that you understand how the various control parameters work.  

Link to comment
Share on other sites

11 hours ago, Always Stillwater said:

2. move the avatar in scripted direction (script using keys instead of avatar) - and yes, i know this movement would be inferior to normal object vehicle movement.

The problem with this is that there are few ways to move the avatar in a scripted way.

The most control you can have is llMoveToTarget, but you can't effectively control the avatar's rotation at all. An avatar will tend to slowly face towards the direction it is being moved with MTT, but you can't speed up or slow down that rate. Similarly, you can't tilt an avatar forwards/backwards when going up/downhill, so you will have to rotate the attachment itself for pitch. (And create animations for each angle, if the avatar is meant to be visible.)

Speaking of slopes, since you won't be using physics to control the vehicle's movement, you'll have to use multiple llCastRay calls to determine the angle of the surface you're on, or if it's even driveable. The problem with this again is that if your vehicle is meant to be driveable out of mouselook, you can't place those raycast checks to accurately match the orientation of your vehicle.

I'm not saying it's impossible, just fairly complicated.

Edited by Wulfie Reanimator
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

as everyone has mentioned already, we pretty much have to write our own impulse engine for this.

People like Argent Stonecutter and a few others were deep into impulse engines back in the day. Old school impulse engines which go way back to the time before the LSL vehicle engine

as has been mentioned we can't rotate/turn the avatar with LSL, What we can do in this old school way is to apply impulse as we turn, to create a drifting effect. A example of drifting an avatar goes something like  this:

// stick this script in a prim and wear the prim
// press left or right arrow keys to see the drifting effect

default
{
    state_entry()
    {    
        llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);            
    }
    
    run_time_permissions(integer perms)
    {
        if (perms & PERMISSION_TAKE_CONTROLS)
        {
            llTakeControls(CONTROL_ROT_LEFT | CONTROL_ROT_RIGHT, TRUE, TRUE);  
        }
    }
    
    control(key id, integer levels, integer edges)
    {
        integer drifting = (levels & CONTROL_ROT_LEFT) | (levels & CONTROL_ROT_RIGHT);
 
        if (drifting)
        {
             llApplyImpulse(<0.2, 0.0, 0.0>, TRUE);     
        }
    }
}

 

 

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1727 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...