So I am trying to implement a suplex move in my game.
When the player object touches an enemy while “suplexing” is true, the player does an animation where it moves up a bit, rotates a total of 540 degrees and then comes back down. I want the enemy touched to be essentially rotating along with the player during this.
I thought a nice and easy way to do this would be to simply make the enemy a child of the player during the suplex and then unchild it after.
So far I have this:
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.CompareTag("enemy"))
{
enemyContacted = true;
contactedEnemy = collision.gameObject;
contactedEnemy.GetComponent<Rigidbody2D>().isKinematic = true;
contactedEnemy.GetComponent<Collider2D>().enabled = false;
Vector2 tempEnemyDir = new Vector2(player.transform.position.x + 1, player.transform.position.y);
contactedEnemy.transform.position = tempEnemyDir;
player.animator.Play("player-suplex");
}
}
everything in this block appears to work as expected… I can see the enemy added as a child in the hierarchy during runtime, BUT, it does not rotate with the player during the animation.
If I manually rotate the player outside of the animation it DOES rotate with the player.
Anyone know why it’s not rotating after being added as child??
Thanks!