- Home /
find rotating direction of object on circle
Object coming from circle A and colliding circle B. On collision of object how to find in which direction object should rotate on circle, clockwise or anticlockwise. circle A and B can be in any positions ie parallel to each other horizontally, vertically and diagonally. i have followed fauxgravity https://www.youtube.com/watch?v=gHeQ8Hr92P4 and making 2D game.
Answer by screenname_taken · Apr 22, 2015 at 02:34 PM
That can be easily checked by reading the rigidbody's angularVelocity."insert the axis you want to read here" (i.e. rigidCache.angularVelocity.x; Note: rigidCache is just a variable that i cached my rigidbody in at Start() ) it'll be positive or negative depending on which way it's turning.
If what you want to do is to have a character jump on a rotating something and then stick to it and rotating along with it, you may just try to parent the player to the moving platform.
Keep in mind that if you are using gravity, the player won't stay on the parent if it goes under it. Gravity will pull it down.
Edit: Do you mean though that your roller is stationery and you want it to rotate accordingly once the player jumps on it?
Then add a rigidbody to it, give it mass, and at the Freeze rotation tick the boxes of the rigidbody component tick all the axis except the one you want to revolve through.
I want to rotate player around circle on collision accordingly in clockwise or anitclockwise. I have used rigidbody2d, so freezing rotation of axis and reading angularvelocity is not possible. I have updated above diagram for proper understanding.
Your answer
![](https://koobas.hobune.stream/wayback/20220613193753im_/https://answers.unity.com/themes/thub/images/avi.jpg)