- Home /
Moving Object by touching it?
Im making a 2D game and i want to push a object when the character controller hits it" How can i do that?
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
Answer by hexagonius · Mar 29, 2013 at 08:35 PM
As 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
Your answer
Follow this Question
Related Questions
How should I move an object that parents on collision? 1 Answer
using Transform on a Object will not move it 100% exactly... 1 Answer
Editor like spore? (move object on other object) C# 0 Answers
Rotate object with another object 0 Answers
How to move an object around with the arrow keys (Javascript) 1 Answer