- Home /
Moving an object with a collider in 2d?
Warning: big noob here. Can anynoe tell me why following doesn't work?
function OnTriggerEnter2D(other: Collider2D) {
Collider.transform.Translate(0,32.4,0);
};
What I want to have happend is to move the object which the object with this script is colliding with. Can anyone help me?
Answer by robertbu · May 03, 2014 at 07:29 PM
If you are talking about getting it to compile, then yea. Collider is a class. If you are trying to move the 'other' object, then it should be:
other.transform.Translate(0,32.4,0);
If you are trying to move the object this script is attached to:
transform.Translate(0,32.4,0);
Your answer
Follow this Question
Related Questions
what collider to use for 2d movement? 1 Answer
Bullet fired at enemy only applying damage when the enemy moves 1 Answer
Polygon Collider 2D doesn't have the "edit collider" button avaliable. 0 Answers
Locking move direction and rotation in JavaScript 1 Answer
How to create random movement in 2D 2 Answers