Jump to content
Oovee® Games

Archived

This topic is now archived and is closed to further replies.

Hein

[How to] Create Shocks and Springs using AutomaticIK

Recommended Posts

This post is a combination of several posts found on the web.archive.org site. One of our community contributors, freeman, stumbled upon this gem. Not all of the pictures could be rescued this way but it should stil be of great help to mod makers wanting more realistic suspension on their rides. Tattoo unfortunately left the forum but this bit of how-to is just too good to leave out. Credits go to Tattoo for writing this next bit.

 

==================================

 

Ok, so you have your springs ready to weight and you see the post above and say to yourself, 'That's a LOT to read and is gonna take forever to do. Darn it, I wish there was an even easier way". Well, your wish has just come true.

 

Marijn and I have been at it again, Marijn is just brilliant with coding, and I present to you now the even easier way to weight a spring. The code below will weight the spring in a blink of an eye, literately! And I mean LITERATELY!

 

VERY IMPORTANT NOTE:  When creating bones, the first bone is named Bone001. When you create another bone, or clone the first bone, it is named Bone002. For this script to work correctly, Bone001 needs to be positioned at the pivot point of the bone because the vertices are numbered starting from the pivot point of the spring. You would then use Bone002 for the other end of the spring. What matters most is that the bone that is positioned at the pivot point of the spring is at the top of the list of bones in the Parameter section of the Skin modifier. The best way to do this is to not change the bone names until after you use this script.

 

This is how they should look in the Skin modifier. Bone001 is positioned at the pivot point of the spring and Bone002 is positioned at the top of the spring.

 

gif.gif  MaxScript1.jpg   120.19KB   0 downloads

 

The code below is a MaxScript. Copy all of the code and paste in into a text file. Now name and save it with a .ms file extension and save it somewhere where you can find it easily to use in Max because you will be opening this script in Max. I just tested this, briefly, and it works on springs with any amount of turns and/or segments.Download the script from the download manager (link below), and follow the included instructions to get it running.

 

EDIT: I just figured out that MaxScripts go into this folder of Max and does not need to be found when in this folder. The MaxScript should be in the very first window if placed in the correct folder. Sorry, I didn't realize this before. Still learning Max myself.

C:\Program Files\Autodesk\3ds Max 2014\scripts --- 64 bit version

C:\Program Files (x86)\Autodesk\3ds Max 2014\scripts --- 32 bit version

To use the MaxScript that you saved, follow these steps;

 

1. Create the spring, UVW map it, then convert to editable mesh.

2. Create the bones that will be used to animate the springs and place them into position.

3. Add a Skin modifier to the spring.

4. Add the 2 bones to the Skin modifier and stop. (Do not exit out of the modify panel after adding the bones, it should look like the image below)

gif.gif  MaxScript2.jpg   22.22KB   0 downloads

5. Go to the menu bar and select MAXScript, then Run Script...

6. Locate and select the .ms file that you just saved and hit Open. Or just double click the .ms file.

7. Look down to the bottom left corner of Max and you should see OK in blue.

gif.gif  MaxScript3.jpg   17.43KB   0 downloads

    That means everything went as planned. If there was an error, an error window will pop open telling you there was an error.

 

And your done. Your spring is perfectly weighted evenly and works perfectly when animated. Easy Peasy....

 

===================================

 

MarijnS95: A note on bone order:

If you create a spring from top to bottom, the weight table will have the bottom vertices first, and the top vertices last. In that case you want the bone that's gonna attach to the top of a spring on the as second item in the bone list. The the bottom bone you want to be in on the bottom.

Maybe this picture explains better:

yFbN0ug.png 

 

Download the 3ds weight tool here

Share this post


Link to post
Share on other sites

For this to be a complete ik writeup you kinda need a linking and xml writeup. Otherwise all this shows you how to do is weight a spring with the spring tool at the moment.

Share this post


Link to post
Share on other sites

@Stetson: we're working on it  <_< but if you want you can do it as well.

Share this post


Link to post
Share on other sites

@freeman i know, but probably 80% of people wont click the link. and without the working pics tattoos original write up is nearly impossible to understand if you don't have a grasp on what the ik is and how it works already along with  fairly extensive prior knowledge of 3ds and the games current and old xmls. I mean I had access to his write-up (before and after he deleted it) and some of his personal examples for years and never understood how the linking, cdts and xml related to each other, until you explained it.

 

@marijn i don't mind helping didn't know it was a WIP, but freeman is the knowledgeable one on the subject.

Share this post


Link to post
Share on other sites

it took me some hours to find out the correct way to set them for truck axles (I didn't knew there was a thread revival project or test truck)

 

but I made it 

but

is there any way to solve the "inertia" move on the end of the bones when added to the truck axles? without having to do the v12 set for real axles and hubs? (this set up on both axles makes the truck/car have no suspension strenght or real center of mass)

XGRQLt3.png

(stock axle setup)

Share this post


Link to post
Share on other sites

can u upload it with Google Drive or other program dropbox ask me to login or create a acount

Share this post


Link to post
Share on other sites

can u upload it with Google Drive or other program dropbox ask me to login or create a acount

 

You can actually say no to that and continue to download.

 

Image 004.png

Share this post


Link to post
Share on other sites
without having to do the v12 set for real axles and hubs? (this set up on both axles makes the truck/car have no suspension strenght or real center of mass

 

 

Center of the mass is not problem - You can move center of the mass of the parent object . Problem is in the suspension - it is substituted by Motor type Spring with all negative results. For example, with ST+ standard suspension can be tuned in the wheel sets. My solution for animated hubs etc. completely dissables this feature. There is possibility to make the chassis with the adjustable clearance (used on my Jamal 8x8), but it is not perfect. For case of use big wheel chassis may be lifted via controlled or powered constraints, in the case of small wheel we can chassis lower to minimal limit.

And another problem - HAVOK physic dislike large mass ratio for connected objects, ideal is around 1:1. When wheel's maas is 100 kg, axle shold have around 100 kg too. This is OK. But truck's main frame is many times heavier than 100 kg. In the result, You should need to divide the main CDT to the many parts with mass around 200, maximum 300 kg for correct HAVOK behaviour. Described division has another nasty effect - stock semitrailers will disconnect on every terrain roughness, because they need parent frame for socket with weight minimum 3500 kg. When my Jamal 8x8 has central bone weighted 2000 kg, all stock semitrailers was unusable. After change from 2000 to 4000 kg semitrailers works without flaws. 3500 kg is minimal limit with some disconnections, 4000 kg is OK without any disconnections of the stock semitrailers.

Share this post


Link to post
Share on other sites

You can actually say no to that and continue to download.

 

attachicon.gifImage 004.png

 

Sorry I didn't see those little letters

 

 

@V12

i see now thanks for the info

 

@VM thanks for sharing the example

Share this post


Link to post
Share on other sites

@VM thanks for sharing the example

 

No problem man, it always helps to see an example as opposed to just reading a tutorial, plus I asked multiple people when I was learning for an example, and no one gave me one, so now that I know, I don't mind sharing it with people who are actually willing to learn.

Share this post


Link to post
Share on other sites

×
×
  • Create New...