Godot Version
4.3
Question
Am I using the scaling correctly? I am following a guide to pop a bubble as the size increases. The guide says to use Vector3.ONE but when I use the script, I do not get the intended size increase when I click the object. I will paste my output as well as the guides instructions / output.
My Output:
extends Area3D
var clicks_to_pop : int = 3
var size_increase : float = 0.2
var score_to_give : int = 1
func _on_input_event(camera, event, position, normal, shape_idx):
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
scale += Vector3.ONE * size_increase
Guides instructions / output:
We will now build upon this to increase the scale of the Balloon and detect if it is big enough to pop, instead of just printing a message to the screen. The first step will then be to increase the scale, to do this we will use this line of code:
func _on_input_event(camera, event, position, normal, shape_idx):
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
scale += Vector3.ONE * size_increase
In this case, we use Vector3.ONE to increase the scale uniformly across all axes. Vector3.ONE is essentially a normal vector, with 1 in every axis (1, 1, 1), so when we multiply it by our size_increase value, we change the 1s to the value of the size_increase variable. If you now save and press Play you will see that if you click the Balloon it will increase in size each time.