- Home /
Question by
ArianneLB · Oct 30, 2015 at 09:02 PM ·
raycastvector3raycastingraycasthitraycasts
Raycast detects box collider, but not capsule collider
I've been trying to use recasts to help interpolate the path of my avatar along a round surface. What I'm doing is adding the input vector to my original position vector, then using Physics.Raycast downwards from there. My raycast detects a collision if the collider underneath is a box, but not if it's a capsule (which is what I need), no matter where I cast along the capsule surface.
bool CanMove (Transform origin, ref Vector3 input){
RaycastHit hit;
Vector3 down = input - origin.up;
Debug.DrawLine (input, down);
if (Physics.Raycast (input, down, out hit)){
input = origin.position + hit.point;
Debug.Log ("Move");
return true;
}
else{
Debug.Log ("Don't move");
input = origin.position;
return false;
}
}
Comment
I am experiencing something similar now. What did you do?
Your answer
Follow this Question
Related Questions
Raycast returns null for no apparent reason 0 Answers
[help]RayCast check [SOLVED] 2 Answers
ScreenPointToRay ray not coming through from camera 0 Answers
Raycast not working 2 Answers
Can you figure out raycast origin position from RacyastHit? 2 Answers