- Home /
Question by
chernobyyl · Jul 01, 2020 at 11:10 AM ·
2dcollisionmovement
Smooth Collisions 2D
Hey
Im using a Box Collider on my Player and a Tilemap Collider for the Border. If walk against the border, the player is kinda buggy (Video: https://vimeo.com/434311361) The movement script of the player is:
Vector2 movement;
movement.x = Input.GetAxis("Horizontal");
movement.y = Input.GetAxis("Vertical");
rb.MovePosition(rb.position + movement * speed * Time.fixedDeltaTime);
How can I fix this that it is smoother? Thanks u
Comment
$$anonymous$$y first guess would be that you might be doing your movement in update while using rigidbody physics. Do your movement in the Physics update ins$$anonymous$$d (FixedUpdate) because at that point all transforms should be synced with physics. Alternatively go to Project Settings/Physics(2D) and try enabling Auto Sync Transforms