Hello everyone !
I make my first step in 3D game by making a pong with a little twist : player can rotate her paddle thank to left and rigth key, to give additional velocity when hitting the ball, and the ball can rotate a paddle by pushing the paddle on the impact point.

I was thinking of doing it by creating a rigid body for the paddles, and a kinematicBody for the ball. When the ball hits a paddle, in its code, I look to see if the object that collided is a rigidBody, and if so, I apply an impulse on the collision point with the normal racquet normal * the speed of the ball.

But the racket doesn't move.

I tried to move a rigidBody with a kinematic on another project (a platform game where a player can move a ball), and it works, the rigidBody move.

Do you have an idea?

in Engine

Can you provide the relevant portion of your code? Is the collision detected correctly?

The collision is detected yes.

``````func _physics_process(delta: float) -> void:
var collision = move_and_collide(velocity * delta, false)

if collision:
if collision.collider is RigidBody:
collision.collider.apply_impulse(collision.position, -collision.normal * 100)
velocity = velocity.bounce(collision.normal)
else:
velocity = velocity.bounce(collision.normal)
``````

You're using the position-information of a KinematicCollision2D:

The point of collision, in global coordinates.

However, you use it as the offset-vector for apply_impulse:

The position uses the rotation of the global coordinate system, but is centered at the object's origin.

So you need to calculate the offset yourself:

``````var offset = collision.position - collision.collider.global_position
collision.collider.apply_impulse(offset, -collision.normal * 100)
``````
by (10,634 points)
selected by

Thank you, that solve my problem !