Reputation: 21
I have a spinning object Which has a box collider on it, as it spins it will be coming in contact with a mesh collider on another object, as it does this the mesh is going to deform dependent on where the box hits. I need to know where it is the box hits to be able to make these deformations, however I also want the box not to feel any forces from the mesh as when I do that my entire parent structure spazzes out and flies off to a far away land.
If any one can help that would be great,
Thanks
EDIT: I don't necessarily need the collision information just every point inside either the box collider the game object it would be associated with when the collision happens, from there I can check the values
Upvotes: 2
Views: 3160
Reputation: 31
Please visit this links ....
http://docs.unity3d.com/ScriptReference/Collider.OnCollisionEnter.html
http://docs.unity3d.com/ScriptReference/Collider.OnCollisionExit.html
Upvotes: 2
Reputation: 1422
You will need to use the OnCollision so you get the Collision info, you cant use OnTrigger since you only get a Collider which lacks the info you requested.
The problem is that when you have a object that reacts to OnCollison you WILL get the physical reaction of the collision no mater what.
What you can do is store the objects velocity and/or angular velocity in every fixed update and then read them back after the collision. Im not sure if you can read back the values in the OnCollisionEnter or if you need to record the collision with a bool and then do it in the next fixed update
Upvotes: 0