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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Tiled Collisions Problem

Discussion in '2D' started by Tade3D, Jul 11, 2015.

  1. Tade3D

    Tade3D

    Joined:
    Jul 8, 2015
    Posts:
    7
    Hello, I have a problem with Collisions which I made in Tiled and later transferred to Unity and when the Player walks on the Collisions he/she starts to do Barrel Rolls and it won't stop. Please Help!
     
  2. Salmjak

    Salmjak

    Joined:
    Nov 25, 2014
    Posts:
    20
    Are you using rigidbodies? If so, go to "constraints" under your rigidbody and freeze the rotation.
    This means that you will have to handle all rotations manually from code though.
     
  3. Tade3D

    Tade3D

    Joined:
    Jul 8, 2015
    Posts:
    7
    Yes, I am using RigidBodies. So I have to code the Movement manually?
     
  4. Salmjak

    Salmjak

    Joined:
    Nov 25, 2014
    Posts:
    20
    No. Rotations. Since they are frozen, they won't be impacted by physics (say a rotational force).

    If you're making a 2D game you won't be very interested in rotational physics though (maybe forces on one axis at most).
     
  5. itzclay36

    itzclay36

    Joined:
    Apr 11, 2015
    Posts:
    25
    I freeze the rotation on my 2d platformer character and rotate only in code.

    If you are doing a 2d platformer as it sounds, then you will at some point need to detect if you "Are grounded" with a collider. This is so you will be able to tell the character if it's able to jump or not. If grounded = canjump, otherwise can't jump.

    So when it comes to rotating the character, you can find the rotation of the object you are standing on, and then rotate the character with code manually to match it. More complex colliders call for more complex solutions, but for basic squares it's that easy.

    Works well.