Godot Version
4.3
Question
I want to change gravity while the game is running for one of my character body 2d's but gravity is 980 and a vector and im not sure how to put it in one thing
4.3
I want to change gravity while the game is running for one of my character body 2d's but gravity is 980 and a vector and im not sure how to put it in one thing
If you want to Change the gravity of a CharacterBody2d you can use
CharacterBody2d.gravity_scale = value
is this what you are trying to do?
gravity scale changes the gravity speed to the value right?
The gravity scale will change how the object is affected by the default gravity.
For example if the default gravity is 980 and the gravity_scale of the character is 0.5 the character will have a gravity of 980 * 0.5 = 490
can you show how to format it I keep getting errors
this is a example from one of my projects:
@onready var ball :RigidBody2D = $".."
func drop_ball() -> void:
ball.gravity_scale = 2.0