- Home /
Calculate forces required to rotate around an arbitrary point regardless of center of mass position
I have an object (a cube) with a center of mass offset from the transforms center. If I apply forces in front and behind the cube to induce a spin on the object it will rotate around the center of mass rather than the center position of the transform as it should. Imagine holding a pencil between two fingers and pushing each end in opposite directions so the pencil spins in place.
However I would like to know if it's possible to calculate the forces such that without changing the position they act on they can provide different amounts of force to cause the object to rotate around the transforms center and not the center of mass. Basically I want to counter the uneven distribution of mass so that it appears to rotate around its center. Common sense is telling me this should be possible by applying a greater force on the end closest to the center of mass but I could be way off here. Any help with this would be greatly appreciated.
What you're asking is absolutely doable, but requires an intimate knowledge of physics equations, force, mass, acceleration, and how to calculate all those in a rotating system.
If physics isn't your thing, that's going to be really hard and I suspect will bog your project down for a long time while you figure that out.
If you truly want to do that, go study physics. I occasionally get caught up in these side ventures because I love learning things like that, but it's non-trivial and may take weeks, depending on the complexity of the problem you're trying to understand and your experience level. And, as I said, if math or physics is not your thing, this could be hard.
An alternate solution would be just to fake it, and make two models which have different centers of mass, and perhaps interpolate values between their two positions and create a third cube that approximates the desired difference between rotating around the center of mass, and rotating around the geometric center.
Answer by Owen-Reynolds · Aug 16, 2013 at 07:22 PM
I'd think it's not doable for two reasons: how the program works, and how real physics works.
In practice, it seems easier just to temporarily change the CenterOfMass yourself (very easy to do in code.) Alternately, have code put a temporary hinge joint at the "spin around" spot (attached to just nothing -- counts as being glued to "the scene".)
Coding, I believe that angularVelocity is applied as a spin around the center of mass. So any combination of shoves will result in a straight-line velocity with a spin around the CoM (in the pencil example, the velocities cancel, leaving only the spin, which is the point.)
In real physics, I think the same math appiles. The centerOfMass is the single point the object "counts as being." Like how you can treat the entire earth as being at the center of the planet for gravity. Spinning around the CoM is like being stationary. Spinning around not-the-CoM is like moving in a circle while also spinning at the same rate (so that some non-CoM point isn't moving.) An object isn't naturally going to move in a circle unless something forces it to -- a spinning top has the friction of the tip on the table to do that. There's also some gyroscope effect(?) which I'm 99% sure PhyX doesn't handle.
In other words, clamp a heavy paper clip near the end of a plastic straw and try to spin it around the center. I think it can't be done, and any attempt will simply use the torque to launch the paper-clip like a catapult (dragging the spinning straw with it.)
good points. in my answer, i was more addressing what i believed he wanted to appear to be happening, rather than the actual data of what would happen.
Thank you for your considered responses and I believe you are right. I think what I was really after without fully realising it yet was a solution for the thrust allocation problem. This problem is a really big deal in real life for sea going vessels trying to move in a desired way with a set amount of manoeuvring jets located around it. It's also a very hard problem to solve and I'm not nearly smart enough to give it a go. For now I will just leave the distribution of mass up to the player to balance. If they don't then it wont rotate around the centre and it'll be less efficient as a result.
Your answer
Follow this Question
Related Questions
Ball Rotating Help 0 Answers
About Forces and Time.deltaTime 3 Answers
Add Force without Rotation 2 Answers
AddForce not influenced by rotation 1 Answer
[Solved]Why doesn't this Rigidbody.AddForce work the way I tell it to? 1 Answer