- Home /
problem with instatiated clone
right now i am working on a 3rd person shooter game.I am instantiating enemies. these enemy clone have rigidbody component attached to them because it can be seen in the inspector. but when i am trying to raycast on these. the raycast is not detecting collision with rigidbody?? the range is appropriate
Please attach some code. How do you execute the raycast?
you would have to look at: http://docs.unity3d.com/Documentation/ScriptReference/Physics.Raycast.html
I know how to raycast but in my opinion you cannot ask a question "why is this not working?" without providing code. Also there are several possibilities to execute and to analyse the result of a Raycast: http://docs.unity3d.com/Documentation/ScriptReference/30_search.html?q=Raycast
Physics.Raycast casts a ray within a given range, to retrieve the result just use the RaycastHit object, it's all described in the link I gave you which contains examples. If you still have problems, you can try debugging your raycast by drawing a gizmo http://docs.unity3d.com/Documentation/ScriptReference/Gizmos.DrawRay.html
Answer by lyzard · Jul 10, 2012 at 10:22 AM
you probably need to attach a collider too, check if this is the case
Answer by vinod.kapoor · Jul 10, 2012 at 01:32 PM
thanks lyzard, for solving the mystery for me. it was all because of the collider.........
you're welcome ;) please set the answer as accepted answer such that it closes this thread