public void setServerElementStraf(ServerElement element, Float straf) { // log.debug("accel"); synchronized (directionVector) { setRightDirectionVector(element); directionVector.scale(straf); RigidBody rb = elementToRigidBody.get(element); rb.applyCentralForce(directionVector); // rb.setLinearVelocity(directionVector); } }
public void setServerElementForce(ServerElement element) { // log.debug("accel"); synchronized (directionVector) { RigidBody rb = elementToRigidBody.get(element); Vector3f velocity = new Vector3f(); rb.getLinearVelocity(velocity); velocity.scale(-1f); rb.applyCentralForce(velocity); Vector3f angularVelocity = new Vector3f(); rb.getAngularVelocity(angularVelocity); angularVelocity.scale(-0.5f); rb.applyTorque(angularVelocity); // rb.setLinearVelocity(directionVector); } }
public void applyForce(Vector3f vec) { activate(); body.applyCentralForce(vec); }