Im making a 2D game and i want to push a object when the character controller hits it"
How can i do that?
1 Answer
1As long as it’s not CharacterController against Charactercontroller you should be able to do one of the following if the other object is a
- Trigger: use OnTriggerEnter
- Collider: use OnControllerColliderHit (Called in CharacterController only)
then you could either directly add a force to the rigidbody of the other object if there’s one, or you grab it’s script and call a method that can do that for you.
There’s even more ways to do this, but those two are the first I could think of
Check out the 2D and 3D mario clone tutorials here. The 3D one goes over pushing objects. It could be easily changed to only work in 2D. http://walkerboystudio.com/html/unity_training___free__.html
– emiller100