- Home /
Question by
Robert Carlsson · Oct 22, 2014 at 11:25 AM ·
rigidbodyraycastcollidercharacterjoint
Raycast Problem. CharacterJoint/Rigibodies
Is this a known issue:
Raycasting stopped working after i added Character Joints and Rigidbody to the bones in my model.
I'm using this script, which worked before, but after adding it stopped working:
Ray ray = Camera.main.camera.ViewportPointToRay(new Vector3(0.5F, 0.5F, 0));
hit = Physics.RaycastAll(ray, 1000);
for(int i = hit.Length-1; i >= 0; i--){
Debug.Log(hit[i].transform.name);
The only tags returned in the debug is the ones belonging to the Rigidbodies.
It no longer registers any else (My hitboxes) etc, which is odd since I have raycast all.
Is this solvable by only raycasting certain layers?
Comment
Best Answer
Answer by Robert Carlsson · Dec 04, 2014 at 01:10 PM
The code is somewhat changed and I'm no longer using Character Joints/Rigidbodies
but this is what I'm using now, don't know if the problem stated above is solved. It's only not a problem for me anymore:
hit = Physics.RaycastAll(camPos.transform.position, camPos.transform.forward, 1000, mask).OrderBy(h=>h.distance).ToArray();
for(int i = 0; i < hit.Length; i++){