How would I make a rigid body force in the direction of an entity???
Here is an easy way to do that using some vector math:
var posPlayer = playerEntity.getPosition(); var posEnemy = enemyEntity.getPosition(); var direction = new pc.Vec3().copy(posPlayer).sub(posEnemy).normalize(); // now you can use the direction and scale it to become a force var force = new pc.Vec3().copy(direction).scale(1000); entityToApplyForce.rigidbody.applyForce(force);
No, I mean like how would I do on this project for the player???
Same way, calculate the direction between the two objects as shown above. And then apply the force to the player.