I’m making an infinite runner game and have it set so that the platforms move to the left rather than the player moving forwards. My issue is that I have a platform the loops up and down as it moves left and when my player lands on this specific platform, they start bouncing off the platform, which isn’t what I want.

One way to solve this is by having the player as a child of the platform, which does work and stops the bouncing, but it also means that the player is then moving left along with the platform.

I know why this is happening as a child object will follow the parent object, but I can’t find a way to have my player act to not move with the platform without the bouncing issue.
The player has a rigidbody and box collider attached, the moving player only has a box collider.
Player jumping script:
if (Input.GetMouseButtonDown(0))
{
player_RB.velocity = new Vector2(player_RB.velocity.x, 20);
}
Moving platform script:
private int moveVertical;
void Start()
{
moveVertical = Random.Range(1, 3);
}
void Update()
{
transform.position -= transform.right * (Time.deltaTime * 7);
if (transform.position.x <= -20)
{
Destroy(gameObject);
}
if (transform.position.y < -2f)
{
moveVertical = 1;
}
else if (transform.position.y > 2f)
{
moveVertical = 2;
}
if (moveVertical == 1)
{
transform.position = new Vector2(transform.position.x, transform.position.y + 5 * Time.deltaTime);
}
else if (moveVertical == 2)
{
transform.position = new Vector2(transform.position.x, transform.position.y - 5 * Time.deltaTime);
}
}
Can anyone offer a solution to this? I just want the player to land on the moving platform normally without bouncing or moving to the left with the platform.

