- Home /
Unity changes the collisionDetectionMode in builds
Hi everyone! I'm currently experiencing what i think is a bug. I'm making a minigolf-like game, and for the bounce, I use Vector3.Reflects. Everything works perfectly... in the Editor. When i build the project (as a .app, a .exe or an ipad app), my bounces became weirds. After some search, i was able to reproduce the bug in the editor. It appears when I change the collisionDetectionMode of my ball from Discrete to Continuous Dynamic. I think that Unity changes automaticly the collisionDetectionMode when I build without asking me.
After a few Debug.Ray, it appears that the contact.normal is incorrect, it's slightly leaning (but is fine when the mode is discrete).
Then I tried: To check the number of contact points at each collision: it's still 1. To change the mode of collisionDetection in the script in: fixedUpdate, update, start, OnEnable and Awake. Every time, nothing appens, the collision detection mode is still continuous dynamic To change the value of the timestep and of the solver iteration Count: no improvement.
So i'm a little desesparate. If anyone has a clue, you're my last hope.
Answer by iraldir · Jun 20, 2012 at 11:12 AM
I finaly find out that it was the combination of the "prevent z rotation" and the "mode : continuous dynamic" that make my game buggy. When i removed the "prevent z rotation", everything worked fine.
But that doesn't explain why unity change my rigidbody to "continuous dynamic" when I build, and why I can't change it with script. But at least, my problem is solved.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Collision detection general approaches in Unity3D for C# 1 Answer
How to detect an object inside another object? 1 Answer
How to use contact.point from 2 seperate colliders in a collision? 0 Answers
How to make OnParticleCollision affect multiple GameObject 1 Answer