public override Dictionary<string, DebugPanel.watchDelegate> getDebugVars() { var vars = new Dictionary<string, DebugPanel.watchDelegate>(); vars.Add("angleBetween", () => { return Quaternion.AngleBetween(finalQuat, smoothVelQuat); }); vars.Add("V3AngleBetween", () => { return Vector3.Angle(finalQuat * Vector3.RelativeFront, veh.Velocity); }); vars.Add("dot", () => { return Quaternion.Dot(finalQuat, smoothVelQuat); }); vars.Add("veh.HeightAboveGround", () => { return veh.HeightAboveGround; }); vars.Add("CamFarClip", () => { return targetCamera.FarClip; }); vars.Add("CamNearClip", () => { return targetCamera.NearClip; }); return vars; }
// moved since last time we checked it? bool HasEitherMovedRotatedScaled() { // moved or rotated or scaled? // local Position/Orientation/scale for VR sUpport bool moved = Vector3.Distance(lastPosition, targetComponent.LocalPosition) > LocalPositionSensitivity; bool scaled = Vector3.Distance(lastScale, targetComponent.LocalScale) > LocalScaleSensitivity; bool rotated = Quaternion.AngleBetween(lastOrientation, targetComponent.LocalOrientation) > LocalOrientationSensitivity; // save last for next frame to compare // (only if change was detected. otherwise slow moving objects might // never sync because of C#'s float comparison tolerance. see also: // https://github.com/vis2k/Mirror/pull/428) bool change = moved || rotated || scaled; if (change) { // local Position/Orientation for VR sUpport lastPosition = targetComponent.LocalPosition; lastOrientation = targetComponent.LocalOrientation; lastScale = targetComponent.LocalScale; } return(change); }