Moving Center of Mass for a Vehicle

Ask questions, discuss ideas, get answers
User avatar
Sarge31FR
Posts: 25
Joined: Sun Dec 16, 2012 5:55 pm
Location: Germany
Contact:

Re: Moving Center of Mass for a Vehicle

Post 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
takiwa
Posts: 134
Joined: Mon Dec 30, 2013 4:29 pm
Location: The Great State of Georgia

Re: Moving Center of Mass for a Vehicle

Post 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.
Image
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Moving Center of Mass for a Vehicle

Post 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.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
dudejo
Posts: 71
Joined: Tue Nov 30, 2010 2:33 am

Re: Moving Center of Mass for a Vehicle

Post by dudejo »

For those who don't have the luxury of a 3D editor, can you fake it by tuning the suspension?
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Moving Center of Mass for a Vehicle

Post 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.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
Vilespring
Posts: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: Moving Center of Mass for a Vehicle

Post 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.
A picture is worth a thousand words, but takes up three thousand times the memory.

Area 51: http://battlefieldarea51mod.weebly.com/

Image
"I didn't steal your pizza"
Post Reply