So I have the player with a Rigidbody2d and a box collider 2D with continuous collision detection and dynamic body type. The boxes the player must jump on are dynamic until they have fallen when their rigidbody gets destroyed to stop the wobbling, the box also has a collider 2d on it yet still the player can move through it. The player must move with a lerp as it must only move a certain distance. I'm pretty sure this is the problem, however, I don't know how t fix it. I have multiple raycasts which work very well except when the player lands on the box diagonally. Any help would be much appreciated.alt text
Thanks
void update(){
if (Input.GetAxis("Horizontal") > 0 && moveRight == true && moveRightTimer <= 0)
{
moveRightTimer = 0.15f;
moveX += moveDistance;
if(gameObject.transform.localScale.x < 0)
{
flipPlayer();
}
}
}
void FixedUpdate()
{
MovePlayer();
}
//Moves the player
void MovePlayer()
{
Vector2 PlayerPos = gameObject.transform.position;
PlayerPos.x = moveX;
GetComponent<Rigidbody2D>().MovePosition(PlayerPos + (Vector2)transform.position * Time.deltaTime);
}