Tuesday, 15 April 2014

c# - Remove Box collider of object in unity 3d -



c# - Remove Box collider of object in unity 3d -

here code in update function. object has box collider.

if (input.getmousebuttondown(0)) { ray ray = camera.screenpointtoray(input.mouseposition); if (physics.raycast (ray, out hit3, 400.0f)) { wname = hit3.collider.gameobject.name; destroy(hit3.collider.gameobject); } }

but box collider not getting destroyed.

how can destroy it?

its working code

destroy(hit3.collider);

c# object scripting unity3d raycasting

No comments:

Post a Comment