/** * <code>lookAtDirection</code> sets the direction the camera is facing * given a direction and an up vector. * * @param direction the direction this camera is facing. */ public void lookAtDirection(Vector3f direction, Vector3f up) { this.rotation.lookAt(direction, up); onFrameChange(); }
@Override protected void updateShadowCams(Camera viewCam) { if (light == null) { logger.warning("The light can't be null for a " + getClass().getName()); return; } float zFar = zFarOverride; if (zFar == 0) { zFar = viewCam.getFrustumFar(); } //We prevent computing the frustum points and splits with zeroed or negative near clip value float frustumNear = Math.max(viewCam.getFrustumNear(), 0.001f); ShadowUtil.updateFrustumPoints(viewCam, frustumNear, zFar, 1.0f, points); //shadowCam.setDirection(direction); shadowCam.setFrustumPerspective(light.getSpotOuterAngle() * FastMath.RAD_TO_DEG * 2.0f, 1, 1f, light.getSpotRange()); shadowCam.getRotation().lookAt(light.getDirection(), shadowCam.getUp()); shadowCam.setLocation(light.getPosition()); shadowCam.update(); shadowCam.updateViewProjection(); }
shadowCam.getRotation().lookAt(light.getDirection(), shadowCam.getUp()); shadowCam.update(); shadowCam.updateViewProjection();
tempQuat.lookAt(extent, Vector3f.UNIT_Y); tempQuat.normalizeLocal();
shadowCam.getRotation().lookAt(light.getDirection(), shadowCam.getUp()); shadowCam.update(); shadowCam.updateViewProjection();
public void update(float tpf) { if (enabled && spatial != null) { Quaternion localRotationQuat = spatial.getLocalRotation(); Vector3f localLocation = spatial.getLocalTranslation(); if (!applyLocal && spatial.getParent() != null) { getPhysicsLocation(localLocation); localLocation.subtractLocal(spatial.getParent().getWorldTranslation()); localLocation.divideLocal(spatial.getParent().getWorldScale()); tmp_inverseWorldRotation.set(spatial.getParent().getWorldRotation()).inverseLocal().multLocal(localLocation); spatial.setLocalTranslation(localLocation); if (useViewDirection) { localRotationQuat.lookAt(viewDirection, Vector3f.UNIT_Y); spatial.setLocalRotation(localRotationQuat); } } else { spatial.setLocalTranslation(getPhysicsLocation()); localRotationQuat.lookAt(viewDirection, Vector3f.UNIT_Y); spatial.setLocalRotation(localRotationQuat); } } }
public void update(float tpf) { if (enabled && spatial != null) { Quaternion localRotationQuat = spatial.getLocalRotation(); Vector3f localLocation = spatial.getLocalTranslation(); if (!applyLocal && spatial.getParent() != null) { getPhysicsLocation(localLocation); localLocation.subtractLocal(spatial.getParent().getWorldTranslation()); localLocation.divideLocal(spatial.getParent().getWorldScale()); tmp_inverseWorldRotation.set(spatial.getParent().getWorldRotation()).inverseLocal().multLocal(localLocation); spatial.setLocalTranslation(localLocation); if (useViewDirection) { localRotationQuat.lookAt(viewDirection, Vector3f.UNIT_Y); spatial.setLocalRotation(localRotationQuat); } } else { spatial.setLocalTranslation(getPhysicsLocation()); localRotationQuat.lookAt(viewDirection, Vector3f.UNIT_Y); spatial.setLocalRotation(localRotationQuat); } } }
Vector3f dir = extent.normalize(); tempQuat.lookAt(dir, Vector3f.UNIT_Y); tempQuat.normalizeLocal();
getLocalRotation().lookAt(compVecA, upVector); if ( getParent() != null ) { Quaternion rot=vars.quat1;
q.lookAt(closest.getContactNormal(), Vector3f.UNIT_Y); mark.setLocalRotation(q);
Quaternion quat = new Quaternion(); quat.lookAt(Vector3f.UNIT_Z, Vector3f.UNIT_Y); camNode.setLocalRotation(quat); characterNode.attachChild(camNode);
shadowCam.getRotation().lookAt(direction, shadowCam.getUp()); shadowCam.update(); shadowCam.updateViewProjection();
/** * <code>lookAtDirection</code> sets the direction the camera is facing * given a direction and an up vector. * * @param direction the direction this camera is facing. */ public void lookAtDirection(Vector3f direction, Vector3f up) { this.rotation.lookAt(direction, up); onFrameChange(); }
/** * <code>lookAtDirection</code> sets the direction the camera is facing * given a direction and an up vector. * * @param direction the direction this camera is facing. */ public void lookAtDirection(Vector3f direction, Vector3f up) { this.rotation.lookAt(direction, up); onFrameChange(); }
@Override protected void updateShadowCams(Camera viewCam) { if (light == null) { logger.warning("The light can't be null for a " + getClass().getName()); return; } float zFar = zFarOverride; if (zFar == 0) { zFar = viewCam.getFrustumFar(); } //We prevent computing the frustum points and splits with zeroed or negative near clip value float frustumNear = Math.max(viewCam.getFrustumNear(), 0.001f); ShadowUtil.updateFrustumPoints(viewCam, frustumNear, zFar, 1.0f, points); //shadowCam.setDirection(direction); shadowCam.setFrustumPerspective(light.getSpotOuterAngle() * FastMath.RAD_TO_DEG * 2.0f, 1, 1f, light.getSpotRange()); shadowCam.getRotation().lookAt(light.getDirection(), shadowCam.getUp()); shadowCam.setLocation(light.getPosition()); shadowCam.update(); shadowCam.updateViewProjection(); }
public void update(float tpf) { if (enabled && spatial != null) { Quaternion localRotationQuat = spatial.getLocalRotation(); Vector3f localLocation = spatial.getLocalTranslation(); if (!applyLocal && spatial.getParent() != null) { getPhysicsLocation(localLocation); localLocation.subtractLocal(spatial.getParent().getWorldTranslation()); localLocation.divideLocal(spatial.getParent().getWorldScale()); tmp_inverseWorldRotation.set(spatial.getParent().getWorldRotation()).inverseLocal().multLocal(localLocation); spatial.setLocalTranslation(localLocation); if (useViewDirection) { localRotationQuat.lookAt(viewDirection, Vector3f.UNIT_Y); spatial.setLocalRotation(localRotationQuat); } } else { spatial.setLocalTranslation(getPhysicsLocation()); localRotationQuat.lookAt(viewDirection, Vector3f.UNIT_Y); spatial.setLocalRotation(localRotationQuat); } } }
public void update(float tpf) { if (enabled && spatial != null) { Quaternion localRotationQuat = spatial.getLocalRotation(); Vector3f localLocation = spatial.getLocalTranslation(); if (!applyLocal && spatial.getParent() != null) { getPhysicsLocation(localLocation); localLocation.subtractLocal(spatial.getParent().getWorldTranslation()); localLocation.divideLocal(spatial.getParent().getWorldScale()); tmp_inverseWorldRotation.set(spatial.getParent().getWorldRotation()).inverseLocal().multLocal(localLocation); spatial.setLocalTranslation(localLocation); if (useViewDirection) { localRotationQuat.lookAt(viewDirection, Vector3f.UNIT_Y); spatial.setLocalRotation(localRotationQuat); } } else { spatial.setLocalTranslation(getPhysicsLocation()); localRotationQuat.lookAt(viewDirection, Vector3f.UNIT_Y); spatial.setLocalRotation(localRotationQuat); } } }
public void update(float tpf) { if (enabled && spatial != null) { Quaternion localRotationQuat = spatial.getLocalRotation(); Vector3f localLocation = spatial.getLocalTranslation(); if (!applyLocal && spatial.getParent() != null) { getPhysicsLocation(localLocation); localLocation.subtractLocal(spatial.getParent().getWorldTranslation()); localLocation.divideLocal(spatial.getParent().getWorldScale()); tmp_inverseWorldRotation.set(spatial.getParent().getWorldRotation()).inverseLocal().multLocal(localLocation); spatial.setLocalTranslation(localLocation); if (useViewDirection) { localRotationQuat.lookAt(viewDirection, Vector3f.UNIT_Y); spatial.setLocalRotation(localRotationQuat); } } else { spatial.setLocalTranslation(getPhysicsLocation()); localRotationQuat.lookAt(viewDirection, Vector3f.UNIT_Y); spatial.setLocalRotation(localRotationQuat); } } }
private void pushLookat(Transform transform, DAENode node, MeasuringUnit unit) { TransformedValue<float[]> floatList = node.getContent(FLOAT_LIST); checkTrue(floatList.isDefined()); checkValue(floatList.get().length, 9); float[] data = floatList.get(); Vector3f eye = new Vector3f(data[0], data[1], data[2]).mult(unit.getMeter()); Vector3f dest = new Vector3f(data[3], data[4], data[5]).mult(unit.getMeter()); Vector3f up = new Vector3f(data[6], data[7], data[8]); Vector3f dir = eye.subtract(dest).normalize(); Quaternion rot = new Quaternion(); rot.lookAt(dir, up); Transform t = newIdentity(); t.setTranslation(eye); t.setRotation(rot); t = t.combineWithParent(transform); transform.set(t); }