[SOLVED] Moving Entity, but no Physics

I need help to give the entity physics while moving, my current code only moves the entity, and does not give it physics. I am pretty new to the game engine.

down below is the code I am using.

if(this.app.keyboard.isPressed(pc.KEY_RIGHT)){
this.entity.translateLocal(0.25,0,0);}

Have you looked at this? https://developer.playcanvas.com/en/tutorials/first-person-movement/

Yes, I have, but I am trying to do a 2d player game

add a rigid body component and a collision component… and instead of doing translate local you have to do this.entity.rigidbody.applyForce(x,y,z); or this.entity.rigidbody.applyImpulse(x,y,z);

1 Like

thanks :slight_smile:

1 Like