protected void moveOrientation() { if (Camera.host != owner || !PerfIO.holdMouse) return; AxisAngle4f tmp = new AxisAngle4f(Camera.right, -PerfIO.dy * 0.001f); Quat4f rot = new Quat4f(); rot.set(tmp); owner.getOrientWritable().mul(rot, owner.getOrientation()); owner.getOrientWritable().normalize(); tmp.set(0, Camera.up.y > 0 ? 1 : -1, 0, PerfIO.dx * 0.001f); rot.set(tmp); owner.getOrientWritable().mul(rot, owner.getOrientWritable()); owner.flushChanges(); }
// Note we set teh locations values up, but process does the work, in case teh world changes // without us moving (a door opens) public void locationUpdated(Quat4f rot, Vector3f trans) { // only update if new things have happened if (!prevRot.epsilonEquals(rot, 0.0001f) || !prevTrans.epsilonEquals(trans, 0.005f)) { // set head point currentAvartarHeadPoint.set(trans); currentAvartarHeadPoint.y += avatarCollisionInfo.getCameraAbovePelvisHeight(); tempRotTransform.set(rot); currentCameraMaxVector.set(0, 0, 1); // use a normal tempRotTransform.transform(currentCameraMaxVector); // set max camera vector currentCameraMaxVector.scale(TRAIL_MAX_DIST); // recall for next iter prevRot.set(rot); prevTrans.set(trans); } }