/** * Alter which spatial is controlled. * * @param spatial spatial to control (or null) */ public void setSpatial(Spatial spatial) { this.spatial = spatial; setUserObject(spatial); if (spatial == null) { return; } setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); }
/** * Alter which spatial is controlled. * * @param spatial spatial to control (or null) */ public void setSpatial(Spatial spatial) { this.spatial = spatial; setUserObject(spatial); if (spatial == null) { return; } setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); }
System.out.println("Reset"); vehicle.setPhysicsLocation(Vector3f.ZERO); vehicle.setPhysicsRotation(new Matrix3f()); vehicle.setLinearVelocity(Vector3f.ZERO); vehicle.setAngularVelocity(Vector3f.ZERO);
/** * Enable or disable this control. * <p> * When the control is disabled, the vehicle is removed from physics space. * When the control is enabled again, the physics object is moved to the * spatial's location and then added to the physics space. * * @param enabled true→enable the control, false→disable it */ public void setEnabled(boolean enabled) { this.enabled = enabled; if (space != null) { if (enabled && !added) { if(spatial!=null){ setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); } space.addCollisionObject(this); added = true; } else if (!enabled && added) { space.removeCollisionObject(this); added = false; } } }
System.out.println("Reset"); player.setPhysicsLocation(Vector3f.ZERO); player.setPhysicsRotation(new Matrix3f()); player.setLinearVelocity(Vector3f.ZERO); player.setAngularVelocity(Vector3f.ZERO);
/** * Enable or disable this control. * <p> * When the control is disabled, the vehicle is removed from physics space. * When the control is enabled again, the physics object is moved to the * spatial's location and then added to the physics space. * * @param enabled true→enable the control, false→disable it */ public void setEnabled(boolean enabled) { this.enabled = enabled; if (space != null) { if (enabled && !added) { if(spatial!=null){ setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); } space.addCollisionObject(this); added = true; } else if (!enabled && added) { space.removeCollisionObject(this); added = false; } } }
System.out.println("Reset"); vehicle.setPhysicsLocation(new Vector3f(0, 0, 0)); vehicle.setPhysicsRotation(new Matrix3f()); vehicle.setLinearVelocity(Vector3f.ZERO); vehicle.setAngularVelocity(Vector3f.ZERO);
control.setLinearVelocity(getLinearVelocity()); control.setPhysicsLocation(getPhysicsLocation()); control.setPhysicsRotation(getPhysicsRotationMatrix()); control.setRestitution(getRestitution());
control.setLinearVelocity(getLinearVelocity()); control.setPhysicsLocation(getPhysicsLocation()); control.setPhysicsRotation(getPhysicsRotationMatrix()); control.setRestitution(getRestitution());
public void setSpatial(Spatial spatial) { this.spatial = spatial; setUserObject(spatial); if (spatial == null) { return; } setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); }
/** * Alter which spatial is controlled. * * @param spatial spatial to control (or null) */ public void setSpatial(Spatial spatial) { this.spatial = spatial; setUserObject(spatial); if (spatial == null) { return; } setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); }
public void setEnabled(boolean enabled) { this.enabled = enabled; if (space != null) { if (enabled && !added) { if(spatial!=null){ setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); } space.addCollisionObject(this); added = true; } else if (!enabled && added) { space.removeCollisionObject(this); added = false; } } }
public void setEnabled(boolean enabled) { this.enabled = enabled; if (space != null) { if (enabled && !added) { if(spatial!=null){ setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); } space.addCollisionObject(this); added = true; } else if (!enabled && added) { space.removeCollisionObject(this); added = false; } } }
/** * Enable or disable this control. * <p> * When the control is disabled, the vehicle is removed from physics space. * When the control is enabled again, the physics object is moved to the * spatial's location and then added to the physics space. * * @param enabled true→enable the control, false→disable it */ public void setEnabled(boolean enabled) { this.enabled = enabled; if (space != null) { if (enabled && !added) { if(spatial!=null){ setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); } space.addCollisionObject(this); added = true; } else if (!enabled && added) { space.removeCollisionObject(this); added = false; } } }
public void setSpatial(Spatial spatial) { if (getUserObject() == null || getUserObject() == this.spatial) { setUserObject(spatial); } this.spatial = spatial; if (spatial == null) { if (getUserObject() == spatial) { setUserObject(null); } this.spatial = null; this.collisionShape = null; return; } setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); }
control.setLinearVelocity(getLinearVelocity()); control.setPhysicsLocation(getPhysicsLocation()); control.setPhysicsRotation(getPhysicsRotationMatrix()); control.setRestitution(getRestitution());
control.setLinearVelocity(getLinearVelocity()); control.setPhysicsLocation(getPhysicsLocation()); control.setPhysicsRotation(getPhysicsRotationMatrix()); control.setRestitution(getRestitution());
control.setLinearVelocity(getLinearVelocity()); control.setPhysicsLocation(getPhysicsLocation()); control.setPhysicsRotation(getPhysicsRotationMatrix()); control.setRestitution(getRestitution());
control.setLinearVelocity(getLinearVelocity()); control.setPhysicsLocation(getPhysicsLocation()); control.setPhysicsRotation(getPhysicsRotationMatrix()); control.setRestitution(getRestitution());
control.setLinearVelocity(getLinearVelocity()); control.setPhysicsLocation(getPhysicsLocation()); control.setPhysicsRotation(getPhysicsRotationMatrix()); control.setRestitution(getRestitution());