Hello,
I have a cube, which is actually made with 6 planes. I do it this way so each side has it’s own local space and any object i child to it can use normal transform/rotation adjustments without having an offset for each side. So each child object’s -y axis will fall towards its parent’s side.
I spawn each rigidbody above the actual side, so when i enter runtime, it falls down to the box. I’m using a Constant Force component to do this. I can’t use Relative Force with a -y force, because if the rigidbody rotates then the y-axis also rotates and the rigidbody will go flying in whatever new direction the y-axis points. So i need to manually configure each rigidbody with a specific Force value (ie. rigidbodies on the top side will get a -y force, objects on the right side with get a -x force, etc).
This method works fine, until the cube rotates, because the constant force is connected to the world space which doesn’t rotate. So i need something in between Relative Force (local) and Force (world). I need Parent Force.
I suppose i can always be doing math in fixedupdate() to adjust each constant force component so that it would always point towards the center even when the cube rotates, but that seems pretty heavy to do if i have a lot of rigidbodies in the scene. I was wondering if there was a cleaner way of doing this.
I added a quick Unity project to detail this behavior in case my description is vague. [check the third post] Hold down the A key to rotate the cube, which should then send the cubes flying. The yellow cube depicts why Relative Force can’t work, even when the rigidbody component is on an empty parent (although now i’m experimenting with the constraints parameters, and “freezing y rotation” seems to be behaving how i want, but i don’t want to prevent rigidbody rotation from happening, and if i rotate the cube before the rigidbody actually falls to the plane/surface, then still some weird things happen).
Thank you!