Hey guys i am developing a cricket game. The animation and all is working fine. But it is becoming extremely difficult to time the shot accurately. Means the batsman misses every shot.
I tried increasing the size of the collider. Even that doesn’t seem to help much.
Please keep in mind i am new to unity and go a little soft.
Couple of tips for troubleshooting moving things/collisions
Slow down time, it’s awesome
Unity Editor Menu
/Edit
/Project Settings
/Time
Change “Time Scale” to something slower than 1
Now run your game and see if things do actually collide
Debugging Aids
Attach the script DebugCollision.js (below) to both game objects involved
// ------ DebugCollision.js ------
function OnCollisionEnter(collision : Collision) {
// Displays the names of all objects we are currently touching in this physics frame (in the Debug Console)
// Multiple contacts can occur simulatenously
for (var contact : ContactPoint in collision.contacts) { // Cycle through each point that is contacting another object
Debug.Log(this.name + " hit " + contact.otherCollider.name); // Display the name of this object and the one we hit
}
}
// ------ DebugCollision.js ------
There could be many other reasons why your game doesn’t do what you want it to but try these tips to help identify what is currently happening. I hope this helps you.