- Home /
My SphereCast dont collide with Box collider
Hi
I'm using a Sphere Cast to check other objects around my Character.
When the Sphere Cast hit a sphereCollider, it work well. But it dont hit my box collider.
Here, i made a exemple : http://dl.dropbox.com/u/34961181/Bug/WebPlayer/WebPlayer.html move the blues mob on the sphere cast, it only get the spherical one.
Here, the test scene : https://dl.dropbox.com/u/34961181/Bug/ColliderBugTest.rar
What can i do ? I dont want to use only sphere collider in my game :(
Answer by Bunny83 · Oct 24, 2012 at 10:18 PM
I didn't download the project, but you might start your spherecast too close to the objects you want to hit. Keep in mind you can't hit a collider from the inside, so make sure your spherecast starts outside of all objects you want to hit.
edit
I had a quick look at your project and yes, you're using the sphere cast completely wrong ;) The spherecast is like a raycast. You have to cast "against" a collider. It doesn't work properly when the colliders are already within the sphere's radius.
I guess you want Physics.OverlapSphere instead
Your answer
Follow this Question
Related Questions
Set a variable to a collider type. 1 Answer
How can I make diagonal collisions work with raycasts from a boxcollider? (3D, C#) 0 Answers
AddComponent conforms to shape, size, position of mesh. How do I do this manually? 2 Answers
3D game: Pickups don't disappear when player touches them. 4 Answers
Getting bounds of submeshes 1 Answer