0 votes

I want to increase/decrease a CollisionShape2D circle's radius gradually and up to a min/max limit and honestly i have no idea how, trying to use clamp and movetoward but the latter doesn't work with float values (which the radius is)
So is there something like move
toward for float values and if not, then how do i go on about this?
Complete beginner to godot, gdscript and coding in general and just trying to get out of tutorial hell, so go easy on me.
if Input.is_action_pressed("Sprint"): speed = 150 soundBubble.shape.radius = soundBubble.shape.radius.move_toward(8.5, 60.0, 1.0) if Input.is_action_just_released("Sprint"): speed = 90 soundBubble.shape.radius = soundBubble_StandingRadius #want this to be a gradual change as well

Godot version 3.3.2
in Engine by (15 points)

Have you looked into using a Tween?

1 Answer

0 votes
Best answer

AnimationPlayer can animate any property.

by (846 points)
selected by

Thanks for reminding me, but it wouldn't work for this exact mechanic since multiple actions will be affecting that radius (shooting/running/sneaking) and it would get very messy that way with an animation player.
I simply want to change the radius by a value with an upper/lower limit.
for now i'm using a clamp to keep the radius between two values however its just a band aid solution and i need something like move_toward that i can use with the radius.

Linear interpolation.

Yep, lerp is what i was looking for

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.