- Home /
How can I capture a mouse position on an invisible plane without a collider?
I want an invisible plane collider to capture mouse clicks but I dont want objects to collide and bounce off the plane. If I take off the collider, then the mouse script doesnt work. Can I make a plane with physics material that does not effect other objects? Thanks
Answer by Thom Denick · Oct 06, 2010 at 03:03 PM
If other objects have a rigidbody, they will bounce off it. (Only one of the objects needs to have the rigidbody for the collision to occur.) So I don't think Joel's answer will work.
What you should do is check the "IsTrigger" box in the collider object. This will ensure objects simply pass through it instead of colliding with it.
Answer by JoelAtMoodkie · Oct 06, 2010 at 12:46 PM
Other objects won't bounce off of it if it doesn't have a rigidbody attached. Removing the rigidbody should have the effect you desire.
If you must have a rigidbody, I think the following will work too:
- Create an empty GameObject.
- Add your plane collider to it.
- Make this new GameObject a child of your GameObject which contains the rigidbody.
No, I took out the rigidbody before. All I have is the plane mesh and the collider and the script. If I take out the collider, the script fails. I think the answer would be a physics material that lets objects pass through.
Your answer
Follow this Question
Related Questions
Why is OnDrag triggering but not OnMouseDown? 0 Answers
OnMouseUp not always firing on mesh that is changing 0 Answers
Picking Trees with Mouse 5 Answers
OnMouseEnter not working 6 Answers