The question is answered, right answer was accepted
Collisions between two objects are not being detected.
I'm trying to create a 2 player tank battling game. Players can shoot bullets (which are fairly slow-moving projectiles) at each other, with the aim of trying to hit their opponent.
However, I can't for the life of me work out how to detect a collision between one of these bullets and a player's tank. Both the tanks and the bullets have colliders attached to them (a box collider for tanks, and a capsule collider for the bullet) and they both have non-kinematic rigidbodies too.
To try and simply detect a hit, I've attached a script called ShellCollision.cs to the bullet prefab, so that any bullet fired will be able to detect the collision. All I want to do at this point is send a debug message so I know I've got it working.
Here's the code:
public class ShellCollision : MonoBehaviour {
public void onCollisionEnter(Collision col) {
Debug.Log ("Collsion!");
}
}
These are what the Inspector settings for both the tank prefab and bullet prefab look like: Tank
Bullet
Let me know if there's anything else I can give that might be able to help solve this. Thank you in advance!
Answer by $$anonymous$$ · Mar 18, 2018 at 02:23 PM
Welp, looks like I just don't know how to properly capitalise my functions.
I used onCollisionEnter when I should have used OnCollisionEnter.