Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by KingGreat · Jun 15, 2020 at 08:28 PM · physicsrigidbody

How do I stop my player from very slowly sinking into the ground?

I am trying to make an infinite runner and have already made the player and the infinite tile generation. Everything works, except there, is one problem, the player keeps falling little by little over time, even though they are supposed to be on the ground. Once the player sinks enough, they hit the tile of ground in front of them, causing them to fly into the air. How can I prevent the player from sinking into the ground tile so this problem will not happen?

Here is a video of it happening: https://streamable.com/vnbb3c

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by ahsen35813 · Jun 15, 2020 at 08:53 PM

From the video I noticed that the x angle of the player is 0.002 during playtime. Is this intentional? It may be the problem if you are using transform.setRelativePosition. However, if you are using forces to move your player, I cannot think what might be causing this issue.

I also noticed that, the x coordinate and y angle are increasing, and the z angle appears to be decreasing very slowly.

As for potential solutions, maybe try constraining the x rotation of the player and/or starting the game with the player at y 0.1 to make sure the player lands on top of the surface.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image KingGreat · Jun 15, 2020 at 09:20 PM 0
Share

I am using forces to move my player so the problem is not with set.RelativePosition. However, you have alerted my attention to something very odd. When I try to change the player's rotation to (0,0,0) in the inspector, it changes back to (0.001,-0.002, 0.005). Also, when I start the player at a y level of 1.1 and let the player fall, the same issue happens. Freezing the x,y,z rotations of the player seems to fix the issue, but I need my player to be able to rotate in-game so this is not a good long term solution.

avatar image ahsen35813 KingGreat · Aug 26, 2020 at 04:35 PM 0
Share

That is very strange. I hope you can fix the problem!

avatar image Llama_w_2Ls ahsen35813 · Aug 26, 2020 at 06:00 PM 0
Share

I found out this was occuring because my player spawned within a collider. Check if any mesh colliders especially are set to convex just to check if they are intersecting with your player.

avatar image
0

Answer by s4shrish · Aug 26, 2020 at 07:45 PM

If it is what I think it is, it is NOT at all something related to your player sinking. This seems to me something that I even observed in my 2D game, that is sometimes the tile generation is a little bit rough, a VERY small number up and down, just like your player not being at EXACTLY 1.00000000000f value in Y-axis. And at high speed that SMALL bump in the road will make your player go FAR up in the sky. Happened in one of my 2D games, except he was moving horizontally and suddenly jumping despite not being programmed at all.

So to confirm my theory, change your Collider from a Box collider to a Capsule Collider, and limit the rotation of the RigidBody.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

244 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I connect multiple spheres using joints and make a character? 1 Answer

Shooting a cannonball. 6 Answers

Solar System Simulator Orbits Not Working 2 Answers

My object falls through terrain. 8 Answers

How may I observe expected physical interactions while using Rigidbody.MoveRotation()? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges