Hi everyone! I'm working on a project where I want to use CharacterBody2D object for a player and a RigidBody2D object for a ball, which can be pushed and tossed around. Found some tutorials but they're very brief and are not addressing issues I'm encountering. My main problem is that my player object is getting tossed around when the applied push force to the ball is high enough.
I'm currently using this code inspired by GDQuest tutorial:
var collisions_count = character.get_slide_collision_count()
for i in collisions_count:
var collision = character.get_slide_collision(i) as KinematicCollision2D
var collider = collision.get_collider()
if collider is RigidBody2D:
character.velocity.x = input_direction.x * push_strength
collider.apply_impulse(input_direction * push_strength * delta)
Is there perhaps some tutorial addressing this topic?