Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Two physics engine questions

Apotheus Silverman
I write code.
Join date: 17 Nov 2003
Posts: 416
02-02-2004 07:16
I was straying from my usual activity of creating flying things the other day and was struck by what seems to me to be a very odd behavior relating to vehicles.

It seems that vehicles to not like to rotate around the Y axis via ground forces. IE, I made a basic truck frame (high center of mass), drove it around a bit, and got everything behaving the way I want it... except one thing. When I run into a hill, it starts going up the hill, but it stays completely upright.

The front end doesn't want to pitch upwards to actually go up the hill. If I let it sit there long enough, it will eventually pitch upward, but the behavior is nothing like actual gravity.

I witness this behavior in every ground-based vehicle I have seen, except for Cornelius Bach's jeep, which looks like he made some hack to get around it because that thing tends to dance on its front or back wheels all the time. Also, no matter how I changed my truck's script... flags, friction, or anything else, I just couldn't get it to easily pitch up or down. Is this a known issue... is there any way around it?


Question #2, sorta related:
In attempting to get around this behavior, I created physical wheels as separate objects, and then attached them to the truck via a bearing assembly. No matter how loose I made the bearing, SL would not allow me to enable physics on the wheels while they were within the bearing assembly. I got no error message... physics just wouldn't stay checked. Also attempting it via llSetStatus(STATUS_PHYSICS, TRUE) did nothing. I tried using tori, hollow cylinders, and tubes all with the same end result. Why does this happen? Was there an issue in the past with game crashes relating to concave collisions or something along that line so the ability was disabled?

Whew. I think that's enough of that nonsense for now. Any info is appreciated. :-)
_____________________
Apotheus Silverman
Shop SL on the web - SLExchange.com

Visit Abbotts Aerodrome for gobs of flying fun.
Hawk Statosky
Camouflage tourist
Join date: 11 Nov 2003
Posts: 175
02-02-2004 08:34
Well, I'm pretty sure my Bug manages hills, but for the life of me I can't remember how I do it - I _think_ it's related to setting VEHICLE_FLAG_LIMIT_ROLL_ONLY. Either that or it's the fact I don't have a vertical attractor - you may want to check its strength. I'll check in-world later, though.

Good luck with #2 - how big are the bearings? I think physical objects have to be at least 0.1 metres apart -somebody correct me if I'm wrong...

Hope you get your stuff sorted, Ap!
_____________________
This .sig has been cancelled due to lack of interest.
Apotheus Silverman
I write code.
Join date: 17 Nov 2003
Posts: 416
02-02-2004 09:49
Thanks Hawk. I just noticed llRemoveVehicleFlags() in the documentation along with the fact that the default for TYPE_CAR is to have both VEHICLE_FLAG_LIMIT_ROLL_ONLY and VEHICLE_FLAG_NO_DEFLECTION_UP turned on.

Oh my. I was trying to turn them off with llSetVehicleFlags(). How embarassing.

As far as the bearing goes, I am pretty sure I had a little more than 0.1m separation all around, but I will have another look at that when I get time.
_____________________
Apotheus Silverman
Shop SL on the web - SLExchange.com

Visit Abbotts Aerodrome for gobs of flying fun.
Cornelius Bach
Lord of Typos
Join date: 30 Jul 2003
Posts: 241
02-02-2004 10:11
Hiya Apotheus,

If you look at a common hoverboard script you will find logic in it that checks it is is airborn and is so, nose down. along with variables that allow you to set how long before it actually changes pitch. That is what is in use in the Jeep, It works pretty well with the exception of 1 thing. If you are priving on lowlevel prims it works great, but if you place it on the roof of a house it will try to correct its height and you get a wheelie effect. this will NOT stop until you either ground it or temporarily turn off the script.

Regards,
_____________________

Corny

_________________________________
"I've got to go eat now" Andrew Palmerstone
Andrew Linden
Linden staff
Join date: 18 Nov 2002
Posts: 692
02-02-2004 10:22
#1 -- There are several "vehicle behaviors" that can be enabled/disabled and many of them have parameters that can be tweked. I would guess that your vehicle has the "vertical attractor" turned on. If you totally disable the vertical attractor then your vehicle will be able to totally flip over. If you want it to stay upright, but be able to dive and climb, then you want to set the VEHICLE_FLAG_LIMIT_ROLL_ONLY as Hawk mentioned.


#2 -- First of all, making wheels by relying on correct collisions of an axel inside a bearing is not recommended, since it will almost always fail, and could cause the physics engine strife (especially if both pieces are concave). In practice, such "joints" will work best when the objects in question are very large, however their motion won't be smooth since they'll the true LOD (Level Of Detail) of the physical object is usually less than the rendered object on your screen (a trick to speed up the physics engine). There have been a few stable examples in the past that have sorta worked.

Your problem with enabling "physics" was that the wheels were actually in a state of interpenetration with the bearing. SL will not allow you to enable "physics" for objects that are in a state of interpenetration. Due to the facet LOD mismatch, as well as some convexification algorithms for concave objects less than 0.1 meters in at least two dimensions, bbjects may be interpenetrating even if they don't look like they are.


There are some old forum threads that mention this stuff and other details of the physics engine. If I get some spare time I'll try to hunt them down and post links here.
Tcoz Bach
Tyrell Victim
Join date: 10 Dec 2002
Posts: 973
02-07-2004 09:37
"convexification"
_____________________
** ...you want to do WHAT with that cube? **