i have a racing game where you can collide with other cars. i made the collider way smaller than the cars but when i play the ame it's like 5 times bigger than the car can annybody help me how to fix this?
Can you show the code on the car or the object with the collider? It is hard to decipher why without seeing the code.
Code (CSharp): public void OnTriggerEnter2D(Collider2D other) { if (other.tag == "SlipperyEnd") { slippery = false; } if (other.tag == "SlipperyActivate") { slippery = true; } if (other.tag == "OtherCar") { Collide(); } } public void Collide() { HowFast = 0; normalSpeed = 1f; }
Hmm, doesnt appear to be anything with the collider on this script. Are there any other scripts that reference the Collider2D or the Car's sprite size? Also, do the car's colliders immediately grow in size when you start the game or is it after collisions or something?
https://forum.unity.com/threads/collider-too-big.809853/ Isn't this just a duplicate post of this? I would ask that you please don't duplicate posts like this.
None of the code you showed has anything changing the size of colliders or the gameobjects. At this point I would just recreate your gameobject and code and see if it gets fixed. It isnt ideal but has helped me in the past. And, you dont have too much code where it would take longer than 15 minutes.