- Home /
Why Raycast is not working properly?
Can anyone please guide me , i am generating a Cube when an other Game object collides with an other game object and i have attached both box collider and as well as make them rigidbody to both game objects which are colliding with each other, I am using raycast method given in code below . when my object moves faster and triger to that game object it misses generation of cube some time
if(Physics.Raycast(transform.position, transform.forward,out hit,7.0f)) { //Instantiating GameObject but some time when it triger it generate 2,3 object one at a time and sometime it generate nothing }
What you're saying is confusing. If I understand correctly, you're instantiating gameobjects upon collision, right? What are you raycasting for then? And where is your movement script if you say fast movement is the problem? And how do you detect the collision and what are you doing then?
Your answer
Follow this Question
Related Questions
Multi object detection with single ray cast 1 Answer
Raycast from inside an object 2 Answers
Grabbing MonoBehavior object from collision 1 Answer
Send Message On Collision 1 Answer
Layered Collisions 1 Answer