- Home /
[Question]Scaling Limits
This question makes me feel quite retarded.
Basically, I have spent the last 3 hours attempting to limit objects from surpassing a certain size.. the objects are not in charge of checking the size, instead I am basing it upon the projectile, which is shifting the size..
like so:
hit.rigidbody.transform.localScale += Vector3(SizeIncreaseX * Time.deltaTime, SizeIncreaseY * Time.deltaTime, SizeIncreaseZ * Time.deltaTime);
However, I cannot figure out how to actually cause it to check the rigidbody it is effecting before it attempts to expand it further..
//blah beginning of function stuff up here
var Scale = BLAH <-- I need to know what to do to check it
if (Scale <= 10)
{
hit.rigidbody.transform.localScale += Vector3(SizeIncreaseX * Time.deltaTime, SizeIncreaseY * Time.deltaTime, SizeIncreaseZ * Time.deltaTime);
Scale = hit.rigidbody.transform;
}
So yeah, basically I would like to have it check the rigidbody before it starts to scale it.. to me it seems more logical then telling each object it needs to check if it is over a certain size.. :/
Anyhow any ideas or suggestions? they'd be quite welcome.. I am entirely tired out.. and am confused as to why it has caused such a problem.. :/
Thanks, Craze
Answer by duck · Nov 22, 2010 at 09:08 AM
You might find that using localScale.magnitude suits your purpose.
eg:
if (transform.localScale.magnitude <= 10) {
// increase scale
}
Good argument why taking breaks and checking if you are focussed enough to continue are required. Not to mention sleep ;)
xD Now I am attempting to make the $$anonymous$$ass scale correctly in conjunction... FUN :)
Proclyon: Sleep!? Sleep!? What is sleep? I haven't heard of it! What ever it is, sounds useless to game devs like us! :D
Your answer
Follow this Question
Related Questions
How can i make a gameobject grow in size each time it collides with other gameobject? 1 Answer
Scale objects marginally! 0 Answers
How can I scale my object "upwards"? 3 Answers
How to make an object scale indefinately on key press? 3 Answers
How is localScale adjusted when re-parenting transforms? 2 Answers