#handling rapier joints on multi-mesh structures?

9 messages · Page 1 of 1 (latest)

vale finch
#

I have a robot that has the hierarchy of

root
|- hull
   |- model
      |-- primitive_n
          |-- rigidbody
          |-- collider
          |-- Mesh
      |--...
|- wheel
   |- model
      |-- primitive_n
          |-- rigidbody
          |-- collider
          |-- Mesh
      |--...
   |- joint -> hull

- wheel2
  |- ...

but im not sure how to get joints to work for it.

joint on wheel 1 and wheel 2 connect to the hull entity, but the joints do not work when I try them in bevy. Anyone with experience with this know how to get joints to work when they're not on the primtives of the rigid bodies directly?

calm ocean
#

Does the robot entity have a transform? I wouldn't try to put the wheels in the transform hierarchy since in many ways they'll be independent except for the joint constraint.

#

The joints don't work how?

vale finch
vale finch
# calm ocean Does the robot entity have a transform? I wouldn't try to put the wheels in the ...

Thats how I used to do it but:

  • if there are multiple robots in a world, that means its hard to tell what part is for what robot from an inspector menu. If they're a part of a entity hierarchy, its immediately obvious what part is attached to what.
  • having them separate makes moving the robot when its not in a physics context difficult. E.G: you have to have physics enabled to move the entire structure due to no transform propagation.
calm ocean
#

I would have them as part of an entity hierarchy. I’ll have to refresh myself on how bevy and rapier interact to confirm whether the transform hierarchy interferes with it. Maybe it doesn’t.

vale finch
trim blaze
#

I think you want your joint component on your wheels? Add a debug on your joint position, it might be correctly placed, but as your wheel hierarchy is not under the joint, it’s not constrained by it

#

As long as your joint isn’t constrained to a bevy parent, I think you’ll be fine