- Home /
Collider and raycast hit is not working properly
I'm making a bird shooting game ... when I hit a bird(which has a collider) with a bullet(which has a collider and a rigidbody) ... Sometime it hits and sometime it passes right through it. But when I enhance the collider of the bird, it always hits. Just so you know, bird collider is still big enough to take a hit but sometimes it do and sometimes it don't.
Start()
{
ForceShoot = 500f;
initialVelocity = this.transform.forward * ForceShoot;
this.rigidbody.velocity = (initialVelocity);
}
FixedUpdate() {
if (rigidbody) {
this.transform.forward = rigidbody.velocity.normalized;
}
}
PS: I have check hit with both techniques, RaycatsHit and OnCollisionEnter
How fast is it going? Have you tried a better Collision Detection mode?
Do you move things with .position or .Translate?
Not really enough information here.
I'm $$anonymous$$oving things with rigidbody.velocity ... and what do you mean by better Collision Detation $$anonymous$$ode?
Answer by hbalint1 · Apr 14, 2015 at 07:53 AM
maybe this is the problem:
http://answers.unity3d.com/questions/266944/raycast-problem-on-high-speed.html
I already read that and It doesn't help either. What I did for the time being is to scale up the transform a bit and It's doing just fine.
Your answer
Follow this Question
Related Questions
How does collider.Raycast really work? 3 Answers
How to check if a raycasthit detects an angle less than 45 degrees and touches the ground 2 Answers
Collider question 0 Answers
Rigidbody stuck in colliders when moving and ricosheting. 0 Answers
OnCollisionEnter but have colliding object not move the object it collides with 1 Answer