Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script box in a vehicle?

Rutherford Beresford
Registered User
Join date: 2 Sep 2007
Posts: 45
01-05-2009 08:06
In all the basic vehicle tutorials I've seen, they all suggest putting the main "driving" script in the seat of the vehicle and making the seat prim the root prim of the vehicle. This makes sense in a very basic sense as I would think all physics would need to "center" around the driver's experience.

However.

I've been working on both high-prim attachment motorcycles as well as low-prim motorcycles and the same script in both bikes behaves very differently. I can understand this, somewhat, as the low-prim bikes are 31 drive-able prims and the high-prim attachment bikes contain only a half dozen prims, so I'm assuming 6 prims weigh less than 31. I see that changing the material of the prims has to bearing on weight so what do I do to increase a vehicles weight?

Also, in trying to compare my creations to others who have successfully conquered the drive-able bike challenge, I see that many bike makers utilize an invisible "script box" usually situated somewhere around the back tire. Why are folks deviating from the tutorial-suggested location of the scripts being in the root-prim seat? My guess is that is has to do with center-of-gravity but I'm wondering what tools I might use to determine where the true center of the bike is / should be? I'm also curious as to whether or not the rotation of this script box has any bearing on the vehicles behavior?

My biggest problem with either bike is bounce. When I hit the slightest bump in the road, I become airborn for quite an unnatural amount of time.... seconds instead of fractions of a second. Do any of the issues I've mentioned above have any bearing on this particular behavior?

My apologies for the plethora of questions. I'm just trying to get a handle on the "proper" way to build a bike so that it drives and handles in a somewhat realistic manner.

Thank you, in advance, for any and all advice you might have.

Sincerely,
Rutherford Beresford
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-05-2009 08:40
You could try adding a negative buoyancy to effectively increase the force of gravity. Also, to add more mass you can unhollow prims, make them larger, and even add extras if you have to (maybe some invisible ones just for that purpose?). Also, try maybe changing the friction and deflection values. Or, worst case, slow it down. ;)

As for which prim to put the vehicle script into, it actually makes no difference whatsoever. The main things are that: 1.) you have to be careful about the orientation of the ROOT prim of the vehicle, so that what you think is "forward/x-axis" and what the system thinks is "forward/x-axis" are compatible, and 2.) a script controlling the vehicle parameters is going to have to get control input from the "driver". It is the second consideration that usually convinces people to put the main script in the prim that has the driver's sit target set, since llAvatarOnSitTarget() is convenient for detecting a new driver and immediately taking its controls. But note that aside from the avatar snapping to (and "filling";) the sit target and being detectable by llAvatarOnSitTarget(), an avatar does NOT SIT ON A PRIM; the avatar sits on the OBJECT. And I BELIEVE vehicle parameters are set for the object as a whole, so it shouldn't matter whether it is done from a lug nut or the floor board or the steering column or the antenna.
Aztral Aeon
Registered User
Join date: 22 Dec 2007
Posts: 34
01-05-2009 10:28
All the vehicles I've been building lately have the driver's seat, and the vehicle control code in separate prims. The seat i use for sit target, and getting control/setup of the camera. Then when the driver sit's, the seat send a link message to the control prim to get take-over and respond to control input.

Anywayz..
Vivito Volare
meddler
Join date: 10 Nov 2006
Posts: 41
01-08-2009 17:15
Also, you can offset the sit target however you like, positioning the rider as you will. This way, you can center control where you like, and then align the driver/rider/pilot with what ever prim is the seat.
Taeas Stirling
Registered User
Join date: 4 Sep 2004
Posts: 74
01-08-2009 18:00
this is a pretty old issue with car builders. Try setting this flag if you dont have it
VEHICLE_FLAG_LIMIT_MOTOR_UP , it will help keep your bike from motoring up into the air on bumps.
install this line as well if you dont have it
VEHICLE_LINEAR_MOTOR_OFFSET ,it off sets your thrust line from the center of mass of your scripted root prim. This controls how your vehicle reacts when it bumps into things.
Lower it and it tends to climb over things, raise it and it tends to push the nose down.
Now play with these and the other tips you have gotten here for endless hours. Not forgetting that often when you change one thing it screws with the others.
Welcome to the world of vehicle scripting. And now you know why good driving vehicles tend to cost a lot