Hello all!

I hope that this Question, as trivial as it might seem, i just cant wrap my head around it.

The Basic Idea is, that i have PlayerCharacter using a CharacterBody2D Node. What i want to achieve is a Slingshot-like-, "Drag-and-Launch"-Effect/Ability on the Player. (Im using a CharacterBody2D and not a RigidBody, as i want the player to still have manual movement while is_on_floor)

I found ways to setup on how to get the Vector for the Launch, but if i cant apply the Vector and Force through "apply_impulse" since that is only for RigidBodys.

But how could i program a "Launch" Function that applies said Vector and Force to my CharacterBody2D?

I hope that makes sense 😃
Basically what i want to achieve is a similar feel like the Pokio in Mario Odyssee, or atleast get some kind of Slingshot Physics going, similar to Angry Birds.

Can you give me Ideas there?
Thank you!

maybe use math?

like you want impulse

there is _physics_process() funtion that runs everyframe

you have _delta that you can use

So the impulse is this:

direction_vec * some_strenght * _delta * gravity

Now you want to set this value to 0 over time -> over delta

different example

var t = 0.0

func _physics_process(delta):
	t += delta * 0.4

	$Sprite2D.position = $A.position.lerp($B.position, t)

Now add a check if value is near 0 then stop lerping.

Now put all of this together and test.

EDIT: my math could be incorrect

Just add the force to the velocity:

var f = direction * strength
velocity += f