How to change players size with code?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By HelpMe

I’m making a 3D Game and I need to change my players size, when he goes trough an area, but I dont know how. I would be grateful if someone would explain me it. Thank u.

:bust_in_silhouette: Reply From: SweetPie

You change the scale variable. It’s a vector2 or Vector3 depending on the node it’s on.(Vector2 for 2D; Vector3 for 3D)
It would look something like this:

func _on_area_entered(area):
	scale *= 2 #this doubles the size of the node it's attached to.

func _on_area_exited(area):
	scale /= 2 #this halves the size of attached node.

Hope this helps!