- Home /
Raycast wont hit colliders on mecanim
Ok so I've been battling with this for a few days now and have had to resort to asking for help.
I am using standard raycast from the camera position through mouse position to apply a small impulse to a collider/rigid body when it's clicked. Not my overall goal more of a test.
This works fine if I drop a simple cube in to my scene.
Now I add a 3d character, I have tried both an export from DAZ 3D and also the Robot on the Unity mecanim tutorial, results are the same for both.
I apply humanoid animations, create a simple animator controller, set an idle animation, so far so good, the robot stands there doing the idle animation.
I click on him and no raycast is hit, obviously cause I have no colliders. So I go ahead and create a ragdoll for the robot, this creates all the colliders etc yet clicking on the locations of these colliders they are never hit, the raycast just reports that it hit the ground plane
If during run time i disable the animator the robot collapses to the floor using physics and the ragdoll (this is my overall aim, he gets shot and animator is switched off etc) and he lies there on the floor. If I now click on his body parts it hits correctly, impulses are applied to the individual colliders nicely
I understand that I wouldnt be able to apply an impulse to the collider during an animation as it would have no effect, what I am confused about is why won't the ray cast collide with these colliders?
I thought possibly it was my raycast at fault, but if I import the UFPS package the bullets will not collide with the colliders during an animation, they hit the floor behind him, if I disable the animator the bullets hit the colliders as expected
Any info here would really be appreciated as its been a few days now, I'm quite new to Unity too
Thank you