- Home /
Can my player transform scale change OnCollisionEnter interactions
Hi,
I want my character to get killed on collision with an enemy if its under a certain scale (ex: <= 1, 1, 1) but to destroy said enemy if over a scale value. (ex: >1, 1, 1).
So far, my character gains size using the following script:
if(collision.gameObject.tag == "Shrooms")
{
transform.localScale += new Vector3(0.6f, 0.6f, 0.6f);
Destroy(collision.gameObject);
}
Now Id like for my character to destroy an enemy if over a scale but not to if under that scale. I started playing with stuff like this but it doesn't work so far:
if(collision.gameObject.tag == "Enemy")
{
if(transform.localScale.sqrMagnitude >= size)
{
transform.localScale += new Vector3(0.6f, 0.6f, 0.6f);
Destroy(collision.gameObject);
}
}
I'm just throwing this out there but Ill keep trying stuff on my side of things. Thanks to anyone answering.
Your answer

Follow this Question
Related Questions
Translating measurement in rotation speed and game object size to non-technical staff 0 Answers
Warning: "Setting scale failed, ignoring request." ? 1 Answer
Pressing 'Play' makes Unity mess with Transform properties 0 Answers
How can I scale Shuriken particle system? 2 Answers
Why does this not scale smoothly? Any Ideas? Transform.localscale 2 Answers