Jump to content

Vehicle pivoting from rear axle


xigaro
 Share

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

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

Recommended Posts

I've built a big vehicle which is a hollow oblong with a few extra prims. Basically a bus. I have a vehicle script which works well but it steers from the centre of the vehicle instead of the rear axle. I've read that this is because of the object's centre of mass.

I can't find a way to change the centre of mass though.

Changing density of linked prims doesn't seem to work. Putting the script in a child prim at the rear of the vehicle didn't work either. Nor did setting VEHICLE_LINEAR_MOTOR_OFFSET (because it's angular, I suppose).

So - is there a way I can change the centre of mass and/or the pivot from where the vehicle steers?

Thanks for your help in advance!

Link to comment
Share on other sites

I guess a vehicle that steers from a rear axle might exist... but I'm yet to see one. Seems to me all vehicles  even big ones steer from their front axle, otherwise they would be a total wreck as soon as attempted to turn. But thats for the real world. In SL I don't think you can change a physical object center of mass unless adding invisible prims. But what does it matter? All you need to make belief is to make the front wheels <or rear ones if you insist :) > turning while vehicle is turning. This may be either hard or easy depending on the wheels construction.

Link to comment
Share on other sites


Ela Talaj wrote:

I guess a vehicle that steers from a rear axle might exist... but I'm yet to see one. Seems to me all vehicles  even big ones steer from their front axle, otherwise they would be a total wreck as soon as attempted to turn.

The question was about the pivot point, which in RL would be a couple of meters to the side of the vehicle, not on the front or rear axle, not in line with either the front or rear axle aswell I think.

like this


But what does it matter? All you need to make belief is to make the front wheels <or rear ones if you insist
:)
> turning while vehicle is turning. This may be either hard or easy depending on the wheels construction.

That's the best you can do in SL I suppose, just making the wheels steer and not letting the vehicle turn when it's stationary. That way I think you can make quite a believable turn.

Link to comment
Share on other sites

I'm not so sure about this "center of mass" thing; where did you read that?

My impression is that a vehicle's turning axis is determined by its reference frame, which by default is that of the root prim. You can actually change the rotation of the reference frame, but I don't think you can change it's position relative to the root prim's origin.  Moving the script to a child prim shouldn't help, but if I'm right, adjusting the root prim should.  If it's just a hollow cylinder or box, you may get the effect you want using PRIM_SLICE to carve some off the back, sliding it to the rear, and stretching out the front.  If it's a sculpty or mesh... well, you could use a different model, maybe, but I'd just link in a box prim as the new root, wherever you want the axis of rotation to be.

Note that I haven't actually tried this, so maybe the "center of mass" really does determine the axis of rotation, in which case this won't work at all.

Link to comment
Share on other sites

Thanks everyone for your ideas.

Yes to clarify the effect I'm after is pivoting the vehicle at the rear wheels. With a big bus it looks awkward when the rear wheels slide around. I've made a (terrible) animated GIF to show the effect I'm after. Actually my animation is a bit wrong and Kwakkelde's link to this image is exactly what I'm after.

 

bus.gif

I have tried setting the root prim to a cube above the rear axle and put all scripts in that prim, but alas that didn't seem to work either.

Any other recommendations I can try? I've run out of ideas!

Off topic: rear-wheel steering vehicles do exist. Some big lorries in Europe have rear-wheel steering as well as front-wheel steering. Fork lift trucks on building sites steer entirely from the rear (it makes my head hurt watching them).

Link to comment
Share on other sites

i am not sure if something like that is even possible in SL.

SL is still running off its proprietary engine that was created back in the early 2000s and since then, LL has been just adding features to it since then and occasionally adding new script commands here and there, so i doubt that something like this is possible right now.

as far as i can tell, any vehicles in SL will rotate from its center axes no matter where the root prim is, i have driven so many vehicles in SL and from my observation, they all rotate from the center axes point.

but i hope you can prove me wrong, i hope this info helps. 

Link to comment
Share on other sites

hack.jpg

Ela's idea of a giant prim to change the centre of mass seems to have done the trick. Spot the hack on the right :) The other plywood prim inside the bus is the root prim. So it looks like the centre of mass is indeed the pivot point. It now turns on its rear wheels almost as a bus would.

It's not ideal though. There doesn't seem to be much documentation online about how the centre of mass is calculated or how I can alter it.

If anyone has a better suggestion pleaaase let me know! In the meantime I'll keep working with the hunchback bus :)

Thanks everyone for your suggestions so far.

Link to comment
Share on other sites

I have been playing-around with key-framed animation for vehicles but, as is usual with me, have been distracted by other projects.  There are a couple of advantages to key-framed animation; the objects don't have to be physical and they can have a greater physics weight.

This is also relevant to your issue because by varying the relative lateral and rotational components you can make it appear as if the vehicle is turning around any point.  Unfortunately, it was at the stage of experimenting with 'real' steering that I got distracted, so I have no concrete results to give you.  For anyone looking for something to play with though, this looks like a promising avenue.

Link to comment
Share on other sites

Peter's right.  This sort of problem may be tackled more easily with keyframed motion. Take a look at this lengthy thread in which the OP was trying to create a vehicle (a follower, in her case) that would track properly and move smoothly around corners  >>> http://community.secondlife.com/t5/LSL-Scripting/Trying-to-make-an-object-follower/td-p/1354695

Link to comment
Share on other sites

  • 9 months later...

first: sorry about my english!

I thinked lot about turnings from cars and trucks since i'm in sl. Same impresseion then the question above: curves dosent look good, because the rotation point is center from primset or center off mass. (linden changed that?)

first i played with a big prim i add on the back. then i tryed add a long prim around the rear axle and cut it in the half. making a long heavy prim that ends far behind the car and is phantom (but the VolumeDetect trick not longer working i guess)

 

>>> so.. i did a test with a simple car script: just mixed some linearY motor to the angularZ motor while curves. DONE!

if the relation between angularY and linearZ is nice it looks like the car/truck turns around the rear axle.

(u can still use the linear motorY (or forceY) while no curves to prevent the car sliding sidewards on a slope)

Pat

Link to comment
Share on other sites

  • 5 weeks later...
You are about to reply to a thread that has been inactive for 4079 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...