Rebound player on Collision

Hey ,
I have player-ship which is dynamic body and moon which is kinematic one. when player collides with moon I want to make rebound effect in which player immediately turn to opposite direction of collision using script .I have used below code but it seems not working fine. How to do the same.


Screenshot (450)

var PlayerCollision = pc.createScript('playerCollision');


PlayerCollision.prototype.initialize = function () {
    this.entity.collision.on("collisionstart", this.onCollisionStart, this);

};

PlayerCollision.prototype.onCollisionStart = function (res) {
    if (res.other.name.startsWith("Moon")) {
        console.log(res.other.name);
        this.entity.script.mouseControl.pointerLocked = false;// not move with mouse  


        var reboundDirection = new pc.Vec3().copy(res.contacts[0].normal).scale(-1);

        var impulseMagnitude = 1000; // Adjust the magnitude as needed
        this.entity.rigidbody.applyForce(reboundDirection.scale(impulseMagnitude));
    }
};