Hello All…
I am continuesly facing a problem that when one gameobject collide with other gameobject then it cross from one another ..
I am using a cube having box collider and one capsule with Capsule collider… when cube collide with capsule then it cross from it , but i want that when it collide with capsule then it can’t cross each other simply no action I wants produce .
Please help fast.
Thanks
Well that depends on how you actually implement the movement of the two gameObjects. Changing the transform.position on those or using Transform.Translate() won’t have any effect on the movement at all once a collision happens. Rigidbodies/Character controllers though automatically make sure that these objects won’t be able to cross each other when using CharacterController.Move() / .SimpleMove(), Rigidbody.AddForce() or similar.
You can also implement your own logic, e.g. through OnCollisionEnter() and such, but by default movement is not going to stop if you change the position directly.
Thanks Glockenbeat for fast Reply
Dear I know OnCollisionEnter() I am using it. I wants when two objects collide each other Nothing is happen means physics property does not work . when the collide then objects just stop at that position.
Unfortunately I think I cannot exactly follow you. Is this the desired behavior, or is that what actually happens and you want to get rid of?
I guess you need to describe that a bit further and possibly post some code as well.