Jump to content

How create a constraint network for simulating Car Suspensions?


mois23

Recommended Posts

Hi Guys,

I'm trying to create a constraint network for simulating Car Suspensions, but with no results. I just need a simple "spring effect" between Body and Wheels (please find a video example attached). How I can do it?

Any suggestion will be really appreciated. Thank you! :)

I've attached a simple file test I'm working on.

Car Example.mp4

Cartest.hip

Edited by mois23
I added an Hip file.
Link to comment
Share on other sites

@vicvvsh - very nice and elegant!

Here's a different approach using a simple double wishbone setup using cone twist constraints (primarily). No idea how accurate or robust it is but it seems to be a starting point for some fun:

rbd.gif.273d690b9421492757a3919e8b5fbcf3.gif

Inspired by this:

https://www.youtube.com/watch?v=GW__Gzkk4G0

(4.53 is where this setup is described)

 

suspension9.hipnc

Edited by julian johnson
  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Well, I couldn't just leave it there so I did do a few further tests but started getting different results between 16.5.496 and 16.5.536 (the sim would explode in .496 but stay stable in .536) so these further tests are in 16.5.536. I noticed that with the conetwist setup in the original the 'freedom' to roll downhill was reduced as though there were some stiffness to the twist in the conetwist constraint so I remade those particular constraints with hard constraints set to position only.

Again, the stiffness of the rotation was quite strong. You can see that test in suspension11.hipnc.

I then converted those new hard constraints to position and rotation but used condof/condir to allow rotation around the wheel rotation axis (but unfortunately that also permits position changes (sliding) along that axis). However, that did allow the whole assembly to travel freely downhill but you can see the wheels sliding a little along their axes. I put the conetwist test in the same scene to see just how great the difference was: suspension12.hipnc. Had to give the conetwists a slight position CFM value to prevent craziness. You can see the conetwist chassis on the right is still very slow to roll.

hard_versus_cone.gif.gif.3e85ca4258c3ae217d0b7ee99f4a0450.gif

Finally, as you do, I did attach a motor to all wheels for some torque! suspension13.hipnc.

motor.gif.gif.fea43d35bd849e072589ca33d6a4a53c.gif

Don't have time at the moment to explore further. Not sure what combination of parameters is driving the stiffness or would loosen it: Position CFM, Position ERP, Bias, Relaxation or the physical properties like Friction, Bounce, Mass. Constraint iterations and solver iterations would also play a part. Very hard to work out the exact contributions of each of those parameters or how they affect the sim and the manual is very 'dry'.

 

suspension11.hipnc

suspension12.hipnc

suspension13.hipnc

Edited by julian johnson
  • Like 4
Link to comment
Share on other sites

Nice progress. Do you have a strategy for adjusting the wheel base to fit various body types? 

I can copy a body to piece6 after the simulation to apply a body style.

car_chassis.gif.d6a830e545fd900626d6f15865316cdf.gif

I tried scaling the chassis geometry before editing but that causes the tires to fall off during simulation. I did notice I am still on Houdini 16.5.496. Do you think that is why the wheels may be falling off when i stretch the chassis?

car_chassis.gif.a14f5e38ae62026f04aef5ebf439599d.gif

Or do the constraint locations also need to be adjusted?

 

 

ap_car_suspension_13_082518.hiplc

Edited by Atom
Link to comment
Share on other sites

Here is a ridiculous hard coded approach to stretching the rig along the Z-axis. I used a Delete node to remove all points except the one where the hard constraint line/bolt was supposed to be. These are hand picked hard-coded numbers that I have typed into the delete node. Then I fetched the point value using the centroid() function so the line uses the actual point geometry for it's location, not a hard coded constant. I did the same thing for tires and springs, only using the centroid of the primitive instead of the point. Finally I used that same primitive centroid offset for positioning the tire geometry in the correct location. With all that in place I was able to stretch the chassis, right after the FileCache node, slightly along the z-axis to match the wheel base of my chosen car body.

Currently there is no X-axis scaling supported so my advice is to scale the body so it fits the X-axis of the chassis then scale the chassis along the Z-axis to dial in the wheel base alignment. The copy the body to piece6.

car_chassis.gif

Untitled-1.jpg

ap_car_suspension_14_082518.hiplc

Edited by Atom
Link to comment
Share on other sites

@Atom - that looks great! Next thing I'd be looking at would be the spring strength, restlength multiplier and damping to control the body oscillations...just as you would tune a normal car suspension system.

You're right the constraints have to be positioned correctly. I did it all manually because it was a quick hack to demonstrate the principles. I've hacked the original hack (!) so that you can now scale the chassis without any manual intervention on the constraint positions:

rescale_chassis.gif.gif.65ce4e280ed47e13ba31e4cbec9b0280.gif

But I think that whole system needs to be built more elegantly from scratch in a more procedural way possibly using a name attribute on the chassis points to generate the appropriate constraints. At the moment it's a kludge.

suspension14.hipnc

  • Like 2
Link to comment
Share on other sites

  • 4 weeks later...
On 14/8/2018 at 5:42 PM, vicvvsh said:

Hello Mattia,

use combination of constraints. Pay attention to constraint attributes condir and condof. In attachment simple example. I hope it helps you.

Cartest_01.hipnc

Hey vicvvsh, I tried your solution but with no result (I can't see Spring Constraints in DOP Network). Can't figure out why.

(here my car model)

Car Destruction v07.hip

Link to comment
Share on other sites

  • 11 months later...
  • 4 weeks later...

Julian! You are a champ! This is absolutely amazing! Thank you so much for sharing the file. For a rookie like me it is absolutely a joy to learn this way :)
Your setup is very straightforward and easy to customize for different car models.

As I played around with it last night I came across a few ideas:
- Ability to reverse (right now the wheels can only spin forward, even when the car is traveling backwards)
- Override wheel rotations (It would be great to make the wheels over- or underrotate for wheelspins or aggressive (no ABS) braking)

The first one I have no idea.
The second one, I have no idea either but that doesn't stop me from digging into it... :D

I guess it would be best to do the overrides directly inside the "distance_travelled" CHOP network.
Maybe I should after the "vector1" (before it goes into the area calculation). I couldn't figure it out yet so any pointers would be massively appreciated.

Link to comment
Share on other sites

Hi K'n'K, glad you liked it. I'm in the middle of a job at the moment so I can only give you brief pointers. You are right, though, I think it can all be done in the distance travelled CHOP. For reverse you need to establish some concept of what constitutes forwards and what constitutes reverse. I think using the tangents of the path curve and bringing them into CHOPs would be the way to do that - then compare the slope vector with the tangent vector. A dot product between the two would give less than 0 for reverse and greater than zero for forwards. Then just multiply the result of the area chop (length) by -1 to negate if you want to reverse (using the dot product to tell you whether you need to). For wheelspin I think a simple animated add to the length chop would do (for a manual spin) or using the acceleration to procedurally increase the length if it goes over a certain threshold. CHOPs are fiddly so it might take a few tries to get it right!

Edited by julian johnson
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...