Page 2 of 2

Re: Moving Center of Mass for a Vehicle

Posted: Sat Nov 30, 2013 12:42 am
by Sarge31FR
You only need the main mesh of the vehicle, since all of its additional parts like turret, gunbase, flaps, rudder or whatever it has have their own positioning for proper rotation etc.

So if you want to change the center of a tank for example, you only need to import its hull mesh, move it to where you want it and then re-export it. If you only need to set the mesh higher above the 0/0/0 grid center, you can easily fix your vehicle by adding/reducing the amount of height you added in max to your objects.con and physics.con

Example:

- Import "m3a1_hull_m1.sm" into 3ds max
- make sure that you set up "Generic units" in Customize -> Units Setup
- select ALL meshes (cols, lods, shadow), move them up on the Z axis to 1.0
- re-export ALL meshes

Now, you can change the code in objects.con by ADDING 0.1 more height to everything that needs to be changed (depends on the vehicle and its coding !)
In physics.con, you need to REDUCE 0.1 of the height from everything in the engine section if its height value is negative, or ADD 0.1 if its value is positive, because otherwise the tracks/wheels would be positioned too low/high.

Example:

- If the tracks/wheels are set to a height of -1.2 in the original physics.con, their new value has to be -1.1
- If the tracks/wheels are set to a height of 1.2 in the original physics.con, their new value has to be 1.3

Hint: Check if the engine of the vehicle in objects.con has a position other than 0/0/0, if it does ONLY change its height ! Same here as with the wheels, if the engine has a negative height value, REDUCE height value by 0.1, if it has a positive or "0" height, ADD 0.1. Do NOT touch the tracks/wheels positions in physics.con in that case, because if you move the engine, they will be moved too by the engine's height setting in objects.con

The value "0.1" is one-tenth of the "1" you set in max. If you used a setting of "2" in max, it would be "0.2" for the code, if you used "2.5" it would be "0.25" for the code and so on. Always divide the number in max by ten !

Ok, i hope i haven't forgotten anything, it's already late :D

Re: Moving Center of Mass for a Vehicle

Posted: Mon Dec 30, 2013 10:16 pm
by takiwa
rather than moving the mesh in Max, just move the pivot point. It serves the same purpose (re-positioning the CoG) without having to re-code the vehicle. I did this with the vanilla Tiger to reduce the god-awful rocking motion that tank has when driving and shooting.

Import the main hull mesh into Max, and under the Hierarchy tab click the Affect Pivot Only button. To raise the CoG, lower the pivot. To lower the CoG, raise the pivot. Export, pack, and play. Because each of the child meshes have their own pivots based on 0/0/0, this move doesn't affect them and you will not have to re-code anything.

Hope that helps.

Re: Moving Center of Mass for a Vehicle

Posted: Wed Jan 01, 2014 4:48 am
by Swaffy
takiwa wrote:rather than moving the mesh in Max, just move the pivot point. It serves the same purpose (re-positioning the CoG) without having to re-code the vehicle. I did this with the vanilla Tiger to reduce the god-awful rocking motion that tank has when driving and shooting.

Import the main hull mesh into Max, and under the Hierarchy tab click the Affect Pivot Only button. To raise the CoG, lower the pivot. To lower the CoG, raise the pivot. Export, pack, and play. Because each of the child meshes have their own pivots based on 0/0/0, this move doesn't affect them and you will not have to re-code anything.

Hope that helps.
I was about to try Sarge31FR's solution, but this seems simpler so I'll try it first. It's easier than going through the whole Objects.con and Physics.con and changing the setPosition on every addTemplated object.

Re: Moving Center of Mass for a Vehicle

Posted: Wed Jan 01, 2014 12:34 pm
by dudejo
For those who don't have the luxury of a 3D editor, can you fake it by tuning the suspension?

Re: Moving Center of Mass for a Vehicle

Posted: Wed Jan 01, 2014 10:15 pm
by Swaffy
dudejo wrote:For those who don't have the luxury of a 3D editor, can you fake it by tuning the suspension?
No. Suspension won't prevent your vehicle from still rolling over when driving on a hill. Especially if the vehicle is driving down a hill and decelerates, the suspension can't stop the forward roll.

Re: Moving Center of Mass for a Vehicle

Posted: Thu Jan 02, 2014 2:14 am
by Vilespring
Swaffy wrote:
dudejo wrote:For those who don't have the luxury of a 3D editor, can you fake it by tuning the suspension?
No. Suspension won't prevent your vehicle from still rolling over when driving on a hill. Especially if the vehicle is driving down a hill and decelerates, the suspension can't stop the forward roll.
well, it can...? by adding some invisible wheels way outside the wheel base for, stability, but it would make driving awkward.