- Home /
How to get the collided plane of a mesh, not just the object,How to get the collided plane of a mesh
Hello, I would like to know how to get the collided plane of a mesh? That way, when OnCollisionEnter() triggers for the bounce pad and the disk seen below, I can make the disks bounce properly.
Answer by asafsitner · Mar 19 at 08:12 AM
Note that OnCollisionEnter receives a Collision as the parameter, and the Collision has the .contacts property, which contains an array of ContactPoint. Each ContactPoint has more information about the collision that you can use, such as the .normal, which is the collided plane orientation of the hit Collider, which you can use to reflect your objects.
You might need to do some filtering to retrieve the ContactPoint you're interested in, though, but the example code here (https://docs.unity3d.com/ScriptReference/ContactPoint-normal.html) should point you in the right direction.
Your answer
Follow this Question
Related Questions
Cannot add Mesh via script 1 Answer
Spawn script on mesh crashes Unity 0 Answers
checking Bool true from another Script? 2 Answers
Filling Closed Shapes 2 Answers
How to make a square mesh and remove a part of it in real time? 0 Answers