- Home /
Casted ray doesn't detect surrounding as an obstacle?
Hello, I was working on this car game demo proj. I am trying to develop a collision avoidance systmem, I am able to avoid cubes and other things created as a gameobjects, but i'm not able to do the same for the surroundings in the track. any suggestions?
Answer by DuckOfDoom · Jun 09, 2013 at 02:54 PM
Do objects in your surroundings have colliders attached? You should check collider parameters to be the same as in your successful attempts. Also, raycast function returns false when you cast from the sphere to outside.
well the thing is how do you attach collider to a non uniform track?
Either use mesh collider, which is very expensive or cover the track with box colliders. That still can give you almost nesessary precision for bouncing off them if you use a lot of them, but for raycasting you don't need much. Even if you're using normals to deter$$anonymous$$e evasive maneuvers, box colliders should be sufficient.