/** * Realign the local forward vector to given direction vector, if null is * supplied Vector3f.UNIT_Z is used. The input vector must be perpendicular * to gravity vector. This normally only needs to be invoked when the * gravity direction changed continuously and the local forward vector is * off due to drift. E.g. after walking around on a sphere "planet" for a * while and then going back to a Y-up coordinate system the local Z-forward * might not be 100% aligned with the Z axis. * * @param vec the desired forward vector (perpendicular to the gravity * vector, may be null, default=0,0,1) */ public void resetForward(Vector3f vec) { if (vec == null) { vec = Vector3f.UNIT_Z; } localForward.set(vec); updateLocalCoordinateSystem(); }
/** * Realign the local forward vector to given direction vector, if null is * supplied Vector3f.UNIT_Z is used. The input vector must be perpendicular * to gravity vector. This normally only needs to be invoked when the * gravity direction changed continuously and the local forward vector is * off due to drift. E.g. after walking around on a sphere "planet" for a * while and then going back to a Y-up coordinate system the local Z-forward * might not be 100% aligned with the Z axis. * * @param vec the desired forward vector (perpendicular to the gravity * vector, may be null, default=0,0,1) */ public void resetForward(Vector3f vec) { if (vec == null) { vec = Vector3f.UNIT_Z; } localForward.set(vec); updateLocalCoordinateSystem(); }
/** * Alter the gravity acting on this character. Note that this also realigns * the local coordinate system of the character so that continuous changes * in gravity direction are possible while maintaining a sensible control * over the character. * * @param gravity an acceleration vector (not null, unaffected) */ public void setGravity(Vector3f gravity) { rigidBody.setGravity(gravity); localUp.set(gravity).normalizeLocal().negateLocal(); updateLocalCoordinateSystem(); }
/** * Alter the gravity acting on this character. Note that this also realigns * the local coordinate system of the character so that continuous changes * in gravity direction are possible while maintaining a sensible control * over the character. * * @param gravity an acceleration vector (not null, unaffected) */ public void setGravity(Vector3f gravity) { rigidBody.setGravity(gravity); localUp.set(gravity).normalizeLocal().negateLocal(); updateLocalCoordinateSystem(); }
/** * Add all managed physics objects to the specified space. * * @param space which physics space to add to (not null) */ @Override protected void addPhysics(PhysicsSpace space) { space.getGravity(localUp).normalizeLocal().negateLocal(); updateLocalCoordinateSystem(); space.addCollisionObject(rigidBody); space.addTickListener(this); }
/** * Add all managed physics objects to the specified space. * * @param space which physics space to add to (not null) */ @Override protected void addPhysics(PhysicsSpace space) { space.getGravity(localUp).normalizeLocal().negateLocal(); updateLocalCoordinateSystem(); space.addCollisionObject(rigidBody); space.addTickListener(this); }
/** * Realign the local forward vector to given direction vector, if null is * supplied Vector3f.UNIT_Z is used. The input vector must be perpendicular * to gravity vector. This normally only needs to be invoked when the * gravity direction changed continuously and the local forward vector is * off due to drift. E.g. after walking around on a sphere "planet" for a * while and then going back to a Y-up coordinate system the local Z-forward * might not be 100% aligned with the Z axis. * * @param vec the desired forward vector (perpendicular to the gravity * vector, may be null, default=0,0,1) */ public void resetForward(Vector3f vec) { if (vec == null) { vec = Vector3f.UNIT_Z; } localForward.set(vec); updateLocalCoordinateSystem(); }
/** * Realign the local forward vector to given direction vector, if null is * supplied Vector3f.UNIT_Z is used. Input vector has to be perpendicular to * current gravity vector. This normally only needs to be called when the * gravity direction changed continuously and the local forward vector is * off due to drift. E.g. after walking around on a sphere "planet" for a * while and then going back to a y-up coordinate system the local z-forward * might not be 100% alinged with Z axis. * * @param vec The new forward vector, has to be perpendicular to the current * gravity vector! */ public void resetForward(Vector3f vec) { if (vec == null) { vec = Vector3f.UNIT_Z; } localForward.set(vec); updateLocalCoordinateSystem(); }
/** * Alter the gravity acting on this character. Note that this also realigns * the local coordinate system of the character so that continuous changes * in gravity direction are possible while maintaining a sensible control * over the character. * * @param gravity an acceleration vector (not null, unaffected) */ public void setGravity(Vector3f gravity) { rigidBody.setGravity(gravity); localUp.set(gravity).normalizeLocal().negateLocal(); updateLocalCoordinateSystem(); }
/** * Set the gravity for this character. Note that this also realigns the * local coordinate system of the character so that continuous changes in * gravity direction are possible while maintaining a sensible control over * the character. * * @param gravity */ public void setGravity(Vector3f gravity) { rigidBody.setGravity(gravity); localUp.set(gravity).normalizeLocal().negateLocal(); updateLocalCoordinateSystem(); }
/** * Add all managed physics objects to the specified space. * * @param space which physics space to add to (not null) */ @Override protected void addPhysics(PhysicsSpace space) { space.getGravity(localUp).normalizeLocal().negateLocal(); updateLocalCoordinateSystem(); space.addCollisionObject(rigidBody); space.addTickListener(this); }
/** * This is implemented from AbstractPhysicsControl and called when the * control is supposed to add all objects to the physics space. * * @param space */ @Override protected void addPhysics(PhysicsSpace space) { space.getGravity(localUp).normalizeLocal().negateLocal(); updateLocalCoordinateSystem(); space.addCollisionObject(rigidBody); space.addTickListener(this); }