I have a turret on a ship and want to apply impulse on fire events. All set to entity forward position except need to reverse it. Searched on the entity API page, forums and google but couldn`t find anything useful or working.
var turretForward = this.turret.forward;
//Gonna apply the backward code one following variable
var turretBack = this.turret.forward;
point = this.turret.script.turret.resultPoint;
var distance = Math.min(Math.max(point.sub(position).length(), 7.5), 20);
this.force = new pc.Vec3();
this.force.copy(turretForward);
this.force.scale(distance * 2, distance * 3);
this.forceBack = new pc.Vec3();
this.forceBack.copy(turretBack);
this.forceBack.scale(distance / 2, distance / 3);
firedBall.rigidbody.applyImpulse(this.force.x, this.force.y + (distance / 25), this.force.z);
//This works but to the forward. I would like to change into reverse version of forward
this.entity.rigidbody.applyImpulse(this.forceBack.x, this.forceBack.y + (distance / 25), this.forceBack.z);
Could link to the project if necessary.