How to rotate with physics applied and with parent-child relationship

We want to rotate a child by reflecting the parent rotation generated by Constraint to the child.
In addition, we would like to make the object output only up to a certain angular velocity when it rotates.

It has taken a lot of trial and error, but I will share the implementation we have reached as of now.

Is there a way to reflect the parent’s rotation to the child and have the child also rotate on its own?

Ultimately, we would like to use this for an arm that grabs a ball in a physics-enhanced space.

I have had several questions recently and always appreciate your help.

pinging @Cedric

Even though this is not the same use case, some parenting with physics has been discussed here as well: Havok and LOD terrain - #10 by CrashMaster

Maybe you can take something from this PG for your own use case:

2 Likes

I’d do the same as your PG: with constraints. You can chain constraints between a various number of parent/child. If you want more controls on the constraints, you can use the 6DOF and tweak more precisely the min/max for angular and linear velocity.

https://doc.babylonjs.com/typedoc/classes/BABYLON.Physics6DoFConstraint

2 Likes

@CrashMaster san.
Thanks. I will refer to it.

1 Like

@Cedric san.

Thanks for the advice.
I have no objection to using constraints to create them.
I connected two objects in the sample, but I believe it is fully possible to chain three or more.

you can use the 6DOF and tweak more precisely the min/max for angular and linear velocity.

The fact that it can be done using 6 degrees of freedom is great.
However, what we currently want is the calculation method.
I have tried and tried, but when the box connected to the ground rotates 180 degrees (90~270 degrees), it cannot maintain 90 degrees.

What is the angular velocity (Euler angle?) about the axis of the hinge constraint based on the rotation of the parent object? Do you know of a way to determine the.

angular velocity is the speed of change on an angle. just like speed/distance but for angular velocity/angle.

1 Like

I wrote it by mistake. My apologies.
Cedric is right.
I would like to know how to calculate the angle when rotating a child object based on the rotation of the parent object.