Making use of PhysicsNode

Hey!



I am trying to use bullet for my character movement instead of the usual setLocalTranslation() on my nodes.



so i have the following :



  public void move(Vector3f force) {
       notifyMove();
     //Move your spatial here
       model.setKinematic(true);
     model.applyTorque(force);
       //model.setLocalTranslation(model.getLocalTranslation().add(newLocation));
      
   }


Which I am trying to get to do my movement.... However thats not working - probably because I dont understand what its meant to do.

Basically I want to send in a parameter like - a force to state what direction my charcter should move - and ideally the strength of the force incase I have a boost / weather affect i wana apply before I send the move call.

Can somebody direct me as to what calls i would make to my physicsNode to support this!

Cheers,

Andy

Torque "twists" an object while force "pushes" it. So you're probably going to want to use force to move instead of torque. Also, what kind of character are you trying to move? It might be more advantageous to use a PhysicsCharacterNode instead.

I thought a PhysicsCharcterNode was not a real physics node???



Currently its just a cube box…But it will be a character on a board. Apply Force does nothing - the box doesnt move at all.

I'm trying to make the same as you. When I apply a force, the player is going to turn around very fast. This is the code that I have:



    public void accelerate(float value)  {

       

        Vector3f direction = this.getNode().getLocalRotation().getRotationColumn(2);

        Vector3f direction2 = this.getNode().getLocalRotation().getRotationColumn(1);



        float yDirection = direction2.y;

        float xDirection = direction.x;

        float zDirection = direction.z;



        Vector3f camLocation = new Vector3f(this.getNode().getWorldTranslation().x+(xDirection10), this.getNode().getWorldTranslation().y+4f, this.getNode().getWorldTranslation().z + (zDirection10));

       

        snbPlayerNode.applyForce(new Vector3f(0, 0, value), camLocation);

    }



I have copied the code from the forum and I don't have a good understanding what it does.

I thought a PhysicsCharcterNode was not a real physics node???



No it is not, but it will probably work better, if you don't need the ability to push stuff by running into it.