protected void TriggerChange(DeltaBasedPlugin input) { if (!mCoordinator.EnableInputUpdates) { return; } Vector3 moveDelta = PositionDelta; moveDelta.X = mEnableX ? moveDelta.X : 0f; moveDelta.Y = mEnableY ? moveDelta.Y : 0f; moveDelta.Z = mEnableZ ? moveDelta.Z : 0f; Rotation orientationDelta = OrientationDelta; orientationDelta.Pitch = mEnablePitch ? orientationDelta.Pitch : 0.0; orientationDelta.Yaw = mEnableYaw ? orientationDelta.Yaw : 0.0; bool wasActive = mDeltaActive; mDeltaActive = moveDelta != Vector3.Zero || orientationDelta.Pitch != 0.0 || orientationDelta.Yaw != 0.0; //TODO - handle keyboard rotation if (Enabled && (mDeltaActive || wasActive)) { if (mCoordinator.ControlMode == ControlMode.Absolute) { float fly = moveDelta.Z; moveDelta.Z = 0f; moveDelta *= mCoordinator.Orientation.Quaternion; moveDelta.Z += fly; Vector3 pos = mCoordinator.Position + moveDelta; Rotation orientation = mCoordinator.Orientation + orientationDelta; mCoordinator.InputUpdate(pos, moveDelta, orientation, orientationDelta); } else { mCoordinator.InputUpdate(Vector3.Zero, moveDelta, Rotation.Zero, orientationDelta); } if (Change != null) { Change(this); } } }
protected void TriggerChange(DeltaBasedPlugin input) { if (!mCoordinator.EnableInputUpdates) return; Vector3 moveDelta = PositionDelta; moveDelta.X = mEnableX ? moveDelta.X : 0f; moveDelta.Y = mEnableY ? moveDelta.Y : 0f; moveDelta.Z = mEnableZ ? moveDelta.Z : 0f; Rotation orientationDelta = OrientationDelta; orientationDelta.Pitch = mEnablePitch ? orientationDelta.Pitch : 0.0; orientationDelta.Yaw = mEnableYaw ? orientationDelta.Yaw : 0.0; bool wasActive = mDeltaActive; mDeltaActive = moveDelta != Vector3.Zero || orientationDelta.Pitch != 0.0 || orientationDelta.Yaw != 0.0; //TODO - handle keyboard rotation if (Enabled && (mDeltaActive || wasActive)) { if (mCoordinator.ControlMode == ControlMode.Absolute) { float fly = moveDelta.Z; moveDelta.Z = 0f; moveDelta *= mCoordinator.Orientation.Quaternion; moveDelta.Z += fly; Vector3 pos = mCoordinator.Position + moveDelta; Rotation orientation = mCoordinator.Orientation + orientationDelta; mCoordinator.InputUpdate(pos, moveDelta, orientation, orientationDelta); } else mCoordinator.InputUpdate(Vector3.Zero, moveDelta, Rotation.Zero, orientationDelta); if (Change != null) Change(this); } }