Objects lose shape on collision.
//Explination.... Hey guys, I had discovered an issue with my game and can not figure out how to fix it. I've done tons of debugging and looking at every little aspect of my game and can't find the issue. I was hoping ya'll could help!
//Problem.... I have my player going down a platform and its like temple run where you have to swipe to move the player side to side. Well when my player collides with an object that is called "obstacle" it ends the game as normal and all the basic physics happen. Sometimes however the obstacle loses its shape for an unknown reason when the player collides with it. For example it will become completely flat and stretch really long or just become really long and sometimes wide. I'm not sure what's causing it. Now the obstacles are a child of a cube with a scale of X=15 Y=1 z=40 if that affects anything. Can you guys help me out?
The only thing in my script is public Player$$anonymous$$ovement movment; Public Game$$anonymous$$anger game$$anonymous$$anager; Public GameObject GameControllerUI; Public AudioSource Obstacle; Void OnCollisionEnter (Collision collisionInfo) { If (collisionInfo.collider.tag == "Obstacle") { movement.enabled = false; Obstacle.Play(); GameControllerUI.SetActive(false); FindObjectOfType().EndGame(); } Public void GameOver() { Scene$$anonymous$$anager.LoadScene("GameOver"); }
Add a Debug.Break() To pause the editor and have a look at the object in question, see if the scale is the same, the mesh the same ect... the first part tho is figuring out when it is doing this, and then it should be easy to see why.
Answer by tas41 · Jul 11, 2018 at 02:23 AM
yeah that empty probably has a scale that isnt 1,1,1. so move the children out, change the scale of that empty to 1,1,1 and put the obstacles back in and that should work
Oh my bad! They are not actually under emty objects! They are under a cube that i used as a platform for the player to move on with a scale of 15, 1, 40
Your answer
Follow this Question
Related Questions
Advance Colision Detection 1 Answer
How to allow an object move within a collider? 1 Answer
Unity 5: AddForce Increases power when already being pushed towards a collider. How to make stop? 1 Answer
Detect overlapping objects 2D game 0 Answers
Children of a hingejoint not colliding with parent's mesh when connectedBody is assigned 1 Answer