Below is part of my collision script, everything is working fine with it.
I am trying to figure out how to make "player" do a smooth rotation and shrink the scale of the player object. How would I go about this? Should I create a check variable and check in update method to do a smooth rotation and I have no clue about smooth scale shrinking. Any help on how to go about this would be appreciated.
if(blackholeActive == true){
player.transform.Rotate(new Vector3(0, 0, Time.deltaTime * -150));
player.transform.localScale = Vector3.Lerp(transform.localScale, new Vector3(0.025f, 0.025f, 0.025f), 0.01f * Time.deltaTime);
}
// Black Hole Collision
if (col.gameObject.tag == "BlackHole")
{
Debug.Log("Black Hole");
int valC = coinCount;
//coinCount = 0;
int valS = starCount; // for stars lost text
//starCount = 0;
//Stop player from moving and falling and make them disappear into blackhole
player.transform.GetComponentInChildren<Rigidbody2D>().bodyType = RigidbodyType2D.Static;
player.GetComponentInChildren<Rigidbody2D>().velocity = Vector2.zero;
player.GetComponentInChildren<Rigidbody2D>().gravityScale = 0;
/// TODO: Stop Blackhole movement
/// Make player spin and shrink
blackholeActive = true;
coinsLost.text = "Coins Lost: " + valC;
starsLost.text = "Stars Lost: " + valS;
gameOverCanvas.gameObject.SetActive(true);
}