# Playmaker Forum

## PlayMaker Help & Tips => PlayMaker Help => Topic started by: Doh on March 11, 2019, 09:42:51 AM

Title: Angular Velocity or Torque with offset.
Post by: Doh on March 11, 2019, 09:42:51 AM
Hey, I was wondering if anyone knows how I might go about creating an orbit-like effect. I'm not looking to create a new center of gravity at all, just something like the "Rotate Around" action but using rigidbody physics. I've included an image to illustrate what I mean.
Title: Re: Angular Velocity or Torque with offset.
Post by: jeanfabre on March 11, 2019, 11:01:08 PM
Hi,

you could use a joint, that would do, but if you want the orbiting planet to be a free body when it comes to collisions, then you'll need something closer to reality, meaning that you have to simulate the gravity with a force ( a force pointing at the orbit center), and also also maintain a velocity for the object to revolve. however doing that is tricky as you need to understand physics math properly, else it overshoots or undershoots.

a last option would be to switch off the rigidbody while rotating around it's orbit and as soon as it collides, turn it into a free rigidbody, so rotating around the orbit is easy, it's simply math.

you can also look on the asset store for such systems,

https://assetstore.unity.com/search?q=gravity&q=sphere&k=gravity%20sphere

Bye,

Jean
Title: Re: Angular Velocity or Torque with offset.
Post by: Doh on March 12, 2019, 05:44:26 AM
Thanks for the explanation Jean, I think my wording and certainly the image have been a bit confusing though. The situation is not quite like a planetary body orbiting a central mass.

I'm revisiting an old setup I had for a conveyor system, due to odd behavior as the rigidbody objects transition from one piece of conveyor to the next, specifically straight pieces to corner pieces and visa-versa. The straight sections use a set velocity to move all of the rigidbodies along the surface of the belt, then corners are very hacky, they parent each rigidbody to a rotating empty game object. The main issue is the velocity applied on the straight sections is not taken into consideration as they are transitioning to the corner section, there is a momentary unwanted acceleration as the force stacks on top of the rotating empty.

So it's a situation where the orbit is only ever around the Y axis. The rigidbodies must be fully active to be able to be knocked around by other forces, colliders and each other.

I'll see what I can do with joints, but I have a feeling that may get a bit messy in some situations.
Title: Re: Angular Velocity or Torque with offset.
Post by: jeanfabre on March 17, 2019, 11:37:03 PM
Hi,

yes, for this I would look into an existing solution, or experiment with inducing velocity based on the conveyor direction of movement.