Rotate two rigidbodies together

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ozergul

Hello
I am trying to rotate two rigidbodies together. What’s the correct way?

enter image description here

what’s the purpose of rotating them ?
do u want them to stop at hit … both or just one ?
got any real life example (to make it simpler)?

Xtremezero | 2020-01-05 21:56

This is my character actually. The plan is to make bouncing ball game, but not with just one ball. With two. And these are rotating around center position :slight_smile:

ozergul | 2020-01-05 22:28

How about making this a single RigidBody with either a single mesh consisting of two balls or two ball meshes. Plus two collision shapes. You can make it rotate via the add_torque method.

It will get more complicated if you actually want two separate rigid bodies. In that case you would use one or more rigidbodies between the balls which are joined with joints. (Emulating some kind of rope/chain).

A completely other way would be to do physics on your own and use kineticbodies instead.

wombatstampede | 2020-01-06 09:06

:bust_in_silhouette: Reply From: Xtremezero

You don’t need to create (2 separate rigid bodies) to achieve this, you can do the following

  • use one rigid body with 2 collision shapes :

Shape 1 ---- Rigid Body ---- Shape 2

then to rotate the rigid body , you just need to apply torque , or mess with the angular velocity of the Rigid body