solo365
solo365

Reputation: 65

Stop objet's movement when colliding with another object

I have a sphere which is moving forward by transform.translate.I want my sphere to stop moving when it is colliding with another gameobject e.g A wall.I've tried many things but can't figure out the proper way.Can anyone help me with it?Thanks in advance...

Upvotes: 0

Views: 107

Answers (2)

Manu
Manu

Reputation: 75

Does your sphere has a collider?

You should read this!

you should put more information in your question next time, like the code so we could help you out even more

Upvotes: 0

N Fard
N Fard

Reputation: 1099

Use OnCollisionEnter.Put in a script that is attached to your object.

OncollisionEnter

Notes: Objects should have colliders and Collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached.

Upvotes: 1

Related Questions