0
\$\begingroup\$

Unity3d

Hello, I'm trying to recreate functionality of outriggers stabilizing a firetruck before the ladder is raised up. How would I go about making the downward force of the outriggers lift the firetruck on that corner of the truck? Most 109ft firetrucks have 4 outriggers that extend out the sides of the truck. Basically Front-Left/Right and Rear-Left/Right.

I'm using wheel colliders and a rigidbody on the main firetruck object which works fine. I then have a child object called Outriggers which holds all 4 outrigger arms and the legs of each. The legs have their own rigidbody and collider. I have the outrigger leg movement working to hit the ground, But not really sure where to go from here.

I was thinking of somehow calculated the amount of leg force hitting the ground then just apply Vector3.up force to the truck, but then my question would be; How would I make sure it lifts only that corner.

Second thought would be changing in realtime the Rigidbody Center Mass to shift to the opposite sides or something. I don't know. Any help would be appreciated.

Firetruck Outriggers

\$\endgroup\$
2
  • \$\begingroup\$ Perhaps the Unity feature you are looking for is physics articulation? I have never worked with that feature before, so I don't feel qualified to write a full answer. \$\endgroup\$
    – Philipp
    Commented Nov 29, 2021 at 15:53
  • \$\begingroup\$ I checked that out. It doesn't look like that's what I need. Truthfully I feel like I'm missing some fundamental physics concept to get this done. \$\endgroup\$ Commented Nov 29, 2021 at 17:03

2 Answers 2

1
\$\begingroup\$

I would model the leg of each outrigger as a separate rigidbody connected to the main rigidbody with a Configurable Joint component. The configurable joint is a very complex component, so I recommend reading the documentation to really understand it.

But in order to get you going, you can configure it like this:

  1. Set "Connected Body" to the rigidbody of the main truck
  2. Set "X Motion", "Z Motion" and all "Angular * Motion" to "Locked"
  3. Set "Y Motion" to "Limited"
  4. Set "Linear Limit" -> "Limit" to the maximum distance you want the leg to be able to extend (note that this limit applies in both directions around the initial position of the object).
  5. Under "Y Drive", set "Position Spring" and "Maximum Force" high enough to lift the truck (at least 10 times its mass assuming normal gravity).
  6. You can now control the extension of the leg with "Target Position" -> "Y" (Script API: ConfigurableJoint.targetPosition). Don't change it too fast, or you make the truck jump :)
\$\endgroup\$
5
  • \$\begingroup\$ Good thing is, my outrigger legs are already set up with their own rigidbody and collider. Let me try to implement this and I'll get back with you. Thanks for the info. \$\endgroup\$ Commented Nov 29, 2021 at 18:11
  • \$\begingroup\$ Well it looks like this would be great if you had to lift the whole truck up at once. Hopefully I'm not doing it wrong but it looks like just lowering one of my outriggers will lift the whole truck up to the same Y distance, I need them to be independent of each other. \$\endgroup\$ Commented Nov 29, 2021 at 19:30
  • \$\begingroup\$ @exceptionsAreBad Well, it works in my test project. Raising just one leg makes it tilt. I can even flip it over by extending the legs on one side fast enough. Although my "fire truck" is just a simple box with a rigidbody and nothing else. It's possible that you have something else attached to it which interferes. \$\endgroup\$
    – Philipp
    Commented Nov 29, 2021 at 19:46
  • \$\begingroup\$ Yea I don't know what's going on. For some reason If I don't lock the position of my truck, the whole truck moves to the side and keeps going. I found a hackaround to use my Wheel Colliders Radius Property and increase it. It does what I want but I would love to see how you have yours set up. We could google meet ? lol \$\endgroup\$ Commented Nov 29, 2021 at 19:53
  • \$\begingroup\$ @exceptionsAreBad My setup is as simple as it can get: the "truck" is a default Cube object with a scale of 5 by 5 by 20 and a rigidbody with a mass of 10. The "legs" are also cubes with only those changes explained above. If you want a private consultation with me, then I would insist that you pay me by the hour. And I am not cheap. \$\endgroup\$
    – Philipp
    Commented Nov 30, 2021 at 11:16
0
\$\begingroup\$

Real physics is seldom how to do this sort of thing; it's notoriously flaky. I recommend playing the animation of the supports coming out, and once it's done, disable movement physics on the truck.

\$\endgroup\$
2
  • \$\begingroup\$ Yea, I'm trying to make this as real as possible. I was also putting a level on the UI to show how level the truck is when you use the outriggers. I already have the ability to individually lower the outrigger legs. I'm just stumped how to raise the truck on individual corners. I realize that I won't be able to use a nested object of the fire truck because it will make the outriggers raise with the truck itself. Not unless I let gravity just keep pulling the legs to the ground and just raise and angle the truck. \$\endgroup\$ Commented Nov 29, 2021 at 15:31
  • \$\begingroup\$ "Real" does not mean "Fun". If the cars in Rocket League used realistic physics, they would tip over when they turn. Watch this VERY informative video for a lot of information about how real physics isn't what you want for most games. youtube.com/watch?v=ueEmiDM94IE \$\endgroup\$
    – Almo
    Commented Nov 29, 2021 at 15:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .