Topic was automatically imported from the old Question2Answer platform.
Asked By
DuskWeaver
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 move_toward 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
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.
I am looking into lerp(), and it is not the same. It requires a weight which goes from 0 to 1 and what I have is the step length, which is the increment per second. I don’t know how to do the transformation