Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Question how to enable rotation when rigidbody2d (dynamic) collides with box collider?

Discussion in 'Physics' started by feliciamah, Mar 17, 2023.

  1. feliciamah

    feliciamah

    Joined:
    Mar 16, 2023
    Posts:
    1
    Hi all, Right now, when my bird collides with the pipe (collider outlines of pipe and bird in below images), the bird does not rotate as I thought it would according to Physics since the bird is constantly moving forward. However, the bird only rotates (a little) when it hits the edge of the pipe. Previously it was working fine but suddenly this bug happened. How would you solve such an issue?

    I am pretty new to unity and could not find answers online to this. Any suggestions would be appreciated!

    Images of collider outlines:
    Screenshot 2023-03-18 at 12.29.16 AM.png

    Screenshot 2023-03-18 at 12.29.12 AM.png
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    9,416
    Could you clarify what you mean here? Why should it be rotating because it's moving?

    Is the bird actually moving? Are you sure you're not just setting the Transform position i.e. teleporting it from position to position (bad). Any movement in physics should be achieved via the Rigidbody2D API.

    A Rigidbody2D is moving when it moves because it has a velocity created by adding a force, setting the velocity, using MovePosition etc.