- Home /
Triggered enlargement?
how do i get my script to when i touch a certain object my size increases. could someone please help thanks!
Answer by AliAzin · Aug 20, 2010 at 07:51 PM
You should attach a collider to your object and check its trigger checkbox. then write something like this:
function OnTriggerEnter(){
target.transform.localScale += 1; // scale one unit on entering trigger.
}
Hope that helps.
Answer by DaveA · Aug 21, 2010 at 12:21 AM
Depends on what you mean by 'touch' and 'my size'
If you mean 'click with mouse' you'll want to use OnMouseDown(). If you mean 'run into it, like a power-up' then see AliAzin's answser.
If you mean 'My 'avatar' gets bigger, like I grow up', then you'll want to increase the size of your player's Character Controller and probably move the camera up higher too, so your 'eyes' are higher off the ground.