- Home /
collision detection problem in fast moving object
I am developing cricket game. when a ball(as sphere collider ) is at high speed it does not collide with bat pass to through bat ( object as box collider). And also when i try to move bat fast for the powerful shot then also ball pass through the bat and not collide.
Answer by farooqaaa · Mar 23, 2012 at 03:40 PM
Use a raycast.
// Collider information will be saved in this variable
RaycastHit hit;
// Distance - Increase or decrease this until you achieve your desired results
float distance = 20f;
if(Physics.Raycast(transform.position, transform.forward, out hit, distance))
{
// collision has occured
// use hit.collider for collider info
}
@lavpatel: Beside the fact that his name contains only two "o" this shouldn't be an Answer!!
Also it would be much more helpful when you upvote / accept the answer.
Your answer
Follow this Question
Related Questions
Why does my player fly through my barrier? 2 Answers
Colliding fast moving object with a slow moving object 1 Answer
Collisions While Rotating Objects Without Character Controllers 1 Answer
Stop joint from jittering when target is on other side of collider 0 Answers
Colliders going through Colliders? 1 Answer