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

a ball moving down a wall with no gravity??

Discussion in 'Getting Started' started by jermainetai0307, Dec 22, 2022.

  1. jermainetai0307

    jermainetai0307

    Joined:
    Nov 10, 2022
    Posts:
    27
    im trying to make a ball bounce off a wall but with no y axis involved. so it just stays on a certain height. but when i get the ball moving and it collides with the wall. it rolls downwards. ( i have yet to figure out how to make it go in the opposite direction yet)
    if it were to roll on the x or z axis due to its sphere shape, thats understandable, but why is it rolling downwards? is it also because of its shape?
    i am using rigidbody for this sphere and have disable gravity already.
    i am ASSUMING i can just stop this by checking if it is touching a wall and just make it stop moving but at the same time i just want to know why this is happening.
     
  2. AngryProgrammer

    AngryProgrammer

    Joined:
    Jun 4, 2019
    Posts:
    437
    Find the Rigidbody in the inspector. Then expand Constraints and here you have options to freeze a specific axis. From what I understand you are interested in selecting Freeze Position Y.

    Edit:
    If that's not the case, it's best to post a demo on https://play.unity.com/. How to publish you have here https://learn.unity.com/tutorial/creating-and-publishing-webgl-builds#.

    Edit 2:
    You must notice that Unity simulates some physical properties. Even if you turn off gravity, the object still has velocity so it can direct it along a different axis. So the object isn't falling, it's just speeding along surface Y.
     
    Last edited: Dec 22, 2022