Hello, I’ve been struggling with a problem recently. I’m making a game that is mainly about jumping from one rotating circular object to the other. The problem is the rotation. I want the player to fly to the other object and then invert himself so that it will look like he’s standing on that object. The player automatically gets parented by the “planet” so i was trying to use Transform.localRotation like so: `private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.tag == "Platforms")
{
transform.SetParent(collision.transform); //setting the parent
transform.localRotation = Quaternion.identity; //trying to nullify the rotation, based on the parents rotation
}`
A snippet of code, where the rotation and parenting happens. When the player is moved again, the player object unparents itself.
The result:
http://prntscr.com/f2ican
The rotation seems to be random, so it must be based on the parent’s rotation. The player has a rigidbody attached to it. Thank you for any and all feedback :).
↧