- Home /
Rigidbody2d.MovePosition not working when I scale the item.
I am building a pong game and I have a rigidbody2d on the paddle(which is a trigger). For wall collision I use ontriggerenter/stay to make is move away from the wall. It works fine when I use it in the beggining but then when I change the paddle's scale, in game, it calls the function but has no movement.
switch(coll.gameObject.layer){
case Wall.Layer:
Vector2 tempV2.x = rigidbody2D.position.x;
tempV2.y = wallHitOffset -
(((BoxCollider2D)collider2D).size.x*transform.localScale.x/2) - 0.03f;
rigidbody2D.MovePosition(tempV2);
break;
}
Answer by MidgardDev · Oct 13, 2015 at 03:18 PM
Hi, did you find any solution? I'm in the same problem right now :(
Answer by Brainversation01 · Oct 16, 2015 at 05:22 PM
Ya for me it was that I was scaling the paddle on update, which was messing with the physics.
Hope this helps @MidgardDev !
Your answer
Follow this Question
Related Questions
Why can i drag colliders through each other? 0 Answers
Rigidbody 2D weird physics on kinematic rotate 1 Answer
What's a good way at keeping a ball bounce around inside the scene? 1 Answer
Box Collider 2d don't collide 3 Answers
Why does poligon collider 2d restricts movement of box collider? 0 Answers