|
I need to detect when a fired bullet hits a Cube GameObject, but I'm kinda failing I am now using the script below, attached to my launcher (which is connected to my FPS controller), which shoots out spheres that have a Sphere Collider and a Rigidbody. I can't seem to get this working :/ (the Doorupperleft is a gameobject that I'm using to test the colliderhittest, it has trigger disabled and has a box collider) So, mainly I just need to be able to get the collision thingie working, I'm failing bigtime :x please help!
(comments are locked)
|
|
I assume you have an object with tag "Doorupperleft", and not an object named "Doorupperleft"? If so, could it be that the bullets are small and moving too fast, and can therefore be on one side of the door in one frame, and passed through the door on the next frame? You could test this by making the collider of the door thicker. If this is the problem, consider using raycasts to detect your bullet collisions.
(comments are locked)
|
|
If you bullet is moving very fast it could be on one side of the door in one frame and on the other side in the next frame, which would prevent the physics engine from detecting the collision. You can fix that by using raycasts:
(comments are locked)
|
