Hello !
I’m working on a 3d maze game project on Android controlled by gyroscope.
I encounter a problem, my ball move perfectly but when I immobilize it a moment (in a corner for exemple but it can happen everywhere) it stay stuck…
I have :
-
a board (his mesh is .obj imported from blender, mesh config on first screen) with mesh collider (also tried with box collider) → config on second screen
-
a ball with sphere collider and rigidbody → config on third screen
A preview of the issue :
It’s very weird, because if I keep moving the ball it work very well…
You can find my project on : https://github.com/hbollon/LabyrinthEvolved/tree/physics
Thanks in advance !
Hello @hbollon ,
From the video that you posted, it looks like there is something on your code that under certain conditions an error occurs, and then the ball position is not updated anymore.
My recommendation is to debug your mobile game, using a USB connection with your computer, checking the logs, where more likely you’ll be able to find the actual error.
You can find more information about how you can do it here: Unity - Manual: Debug C# code in Unity
Happy Coding!
Hi @DiegoDePalacio_1 !
Thanks for your reply.
I have already checked with logcat and I haven’t saw any error/warning when the bug appear…
But I will retry with your link
However, for the moment I don’t have any script on the ball
Ok so I have try to look at debug console in vscode and retry with logcat and I haven’t any error or exception…
I also tried without my board scripts without success.
However, I test now on unity editor with Unity Remote 5 for the gyro and I have noticed than when the ball stop moving (when it’s immobile few seconds) I can fix it by reset his rigidbody or manually moving it but it happens again if it is still immobile
EDIT : I’m on Linux (Ubuntu 18.04) if it can help someone
Ok so I have finally found the reason of this issue
The rigidbody of the ball falls asleep when immobile and wait for physic interraction to awake but my board don’t have rigidbody.
So I have disable it with :
m_Rigidbody = GetComponent<Rigidbody>();
m_Rigidbody.sleepThreshold = 0.0f;
I think you can also just awake it manually in Update method for exemple but in my case I don’t need at all of this sleep function for my ball.
1 Like