/** * Access whichever spatial translation corresponds to the physics location. * * @return the pre-existing location vector (in physics-space coordinates, * not null) */ protected Vector3f getSpatialTranslation() { if (applyLocal) { return spatial.getLocalTranslation(); } return spatial.getWorldTranslation(); }
/** * Access whichever spatial translation corresponds to the physics location. * * @return the pre-existing vector (not null) */ private Vector3f getSpatialTranslation() { if (applyLocal) { return spatial.getLocalTranslation(); } return spatial.getWorldTranslation(); }
private Vector3f getSpatialTranslation() { if (applyLocal) { return spatial.getLocalTranslation(); } return spatial.getWorldTranslation(); }
private Vector3f getSpatialTranslation() { if (applyLocal) { return spatial.getLocalTranslation(); } return spatial.getWorldTranslation(); }
/** * Access whichever spatial translation corresponds to the physics location. * * @return the pre-existing location vector (in physics-space coordinates, * not null) */ protected Vector3f getSpatialTranslation() { if (applyLocal) { return spatial.getLocalTranslation(); } return spatial.getWorldTranslation(); }
/** * Access whichever spatial translation corresponds to the physics location. * * @return the pre-existing vector (not null) */ private Vector3f getSpatialTranslation() { if (applyLocal) { return spatial.getLocalTranslation(); } return spatial.getWorldTranslation(); }
/** * Access whichever spatial translation corresponds to the physics location. * * @return the pre-existing vector (not null) */ private Vector3f getSpatialTranslation(){ if(motionState.isApplyPhysicsLocal()){ return spatial.getLocalTranslation(); } return spatial.getWorldTranslation(); }
/** * Access whichever spatial translation corresponds to the physics location. * * @return the pre-existing vector (not null) */ private Vector3f getSpatialTranslation(){ if(motionState.isApplyPhysicsLocal()){ return spatial.getLocalTranslation(); } return spatial.getWorldTranslation(); }
private Vector3f getSpatialTranslation(){ if(motionState.isApplyPhysicsLocal()){ return spatial.getLocalTranslation(); } return spatial.getWorldTranslation(); }
private Vector3f getSpatialTranslation(){ if(motionState.isApplyPhysicsLocal()){ return spatial.getLocalTranslation(); } return spatial.getWorldTranslation(); }
/** * Sets the spacial for the camera control, should only be used internally * @param spatial */ public void setSpatial(Spatial spatial) { target = spatial; if (spatial == null) { return; } computePosition(); prevPos = new Vector3f(target.getWorldTranslation()); cam.setLocation(pos); }
@Override public void update(float tpf) { if (spatial == null) { throw new IllegalArgumentException("The spatial to follow is null, please use the setTarget method"); } target.setLocalTranslation(spatial.getWorldTranslation()); camNode.lookAt(target.getWorldTranslation(), upVector); target.updateLogicalState(tpf); target.updateGeometricState(); }
/** * Centers the spatial in the origin of the world bound. * @return The spatial on which this method is called, e.g <code>this</code>. */ public Spatial center() { Vector3f worldTrans = getWorldTranslation(); Vector3f worldCenter = getWorldBound().getCenter(); Vector3f absTrans = worldTrans.subtract(worldCenter); setLocalTranslation(absTrans); return this; }
@Override protected void computeLastDistance(Spatial owner) { if (owner.getWorldBound() != null) { BoundingVolume bv = owner.getWorldBound(); lastDistance = bv.distanceSquaredTo(position); } else { lastDistance = owner.getWorldTranslation().distanceSquared(position); } }
@Override protected void computeLastDistance(Spatial owner) { if (owner.getWorldBound() != null) { BoundingVolume bv = owner.getWorldBound(); lastDistance = bv.distanceSquaredTo(position); } else { lastDistance = owner.getWorldTranslation().distanceSquared(position); } }
@Override public void computeLastDistance(Spatial owner) { if (owner.getWorldBound() != null) { BoundingVolume bv = owner.getWorldBound(); lastDistance = bv.distanceSquaredTo(position); } else { lastDistance = owner.getWorldTranslation().distanceSquared(position); } }
@Override public void cloneFields( Cloner cloner, Object original ) { this.target = cloner.clone(target); computePosition(); prevPos = new Vector3f(target.getWorldTranslation()); cam.setLocation(pos); }
public void setSpatial(Spatial spatial) { this.spatial = spatial; setUserObject(spatial); if (spatial == null) { return; } setPhysicsLocation(spatial.getWorldTranslation()); setPhysicsRotation(spatial.getWorldRotation().toRotationMatrix()); }
protected void computePosition() { float hDistance = (distance) * FastMath.sin((FastMath.PI / 2) - vRotation); pos.set(hDistance * FastMath.cos(rotation), (distance) * FastMath.sin(vRotation), hDistance * FastMath.sin(rotation)); pos.addLocal(target.getWorldTranslation()); }
@Override public Vector3f getFinalObserverPosition(int index) { OSVRViewManager vrvm = (OSVRViewManager) environment.getVRViewManager(); if( vrvm == null || isInputDeviceTracking(index) == false ) return null; Object obs = environment.getObserver(); Vector3f pos = getPosition(index); if( obs instanceof Camera ) { ((Camera)obs).getRotation().mult(pos, pos); return pos.addLocal(((Camera)obs).getLocation()); } else { ((Spatial)obs).getWorldRotation().mult(pos, pos); return pos.addLocal(((Spatial)obs).getWorldTranslation()); } }