本文整理汇总了C++中leap::Hand::isRight方法的典型用法代码示例。如果您正苦于以下问题:C++ Hand::isRight方法的具体用法?C++ Hand::isRight怎么用?C++ Hand::isRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类leap::Hand
的用法示例。
在下文中一共展示了Hand::isRight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InterfaceEventTick
//Main Event driven tick
void ULeapController::InterfaceEventTick(float DeltaTime)
{
//This is our tick event that is forwarded from the delegate, check validity
if (!_private->interfaceDelegate) return;
//Pointers
Leap::Frame frame = _private->leap.frame();
Leap::Frame pastFrame = _private->leap.frame(1);
//-Hands-
//Hand Count
int handCount = frame.hands().count();
if (_private->pastState.handCount != handCount)
{
ILeapEventInterface::Execute_HandCountChanged(_private->interfaceDelegate, handCount);
//Zero our input mapping orientations (akin to letting go of a joystick)
if (handCount == 0)
{
EmitAnalogInputEventForKey(EKeysLeap::LeapLeftPalmPitch, 0, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapLeftPalmYaw, 0, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapLeftPalmRoll, 0, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapRightPalmPitch, 0, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapRightPalmYaw, 0, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapRightPalmRoll, 0, 0, 0);
}
}
//Cycle through each hand
for (int i = 0; i < handCount; i++)
{
Leap::Hand hand = frame.hands()[i];
LeapHandStateData pastHandState = _private->pastState.stateForId(hand.id()); //we use a custom class to hold reliable state tracking based on id's
//Make a ULeapHand
if (_private->eventHand == NULL)
{
_private->eventHand = NewObject<ULeapHand>(this);
_private->eventHand->SetFlags(RF_RootSet);
}
_private->eventHand->setHand(hand);
//Emit hand
ILeapEventInterface::Execute_LeapHandMoved(_private->interfaceDelegate, _private->eventHand);
//Left/Right hand forwarding
if (hand.isRight())
{
ILeapEventInterface::Execute_LeapRightHandMoved(_private->interfaceDelegate, _private->eventHand);
//Input Mapping
FRotator palmOrientation = _private->eventHand->PalmOrientation;
EmitAnalogInputEventForKey(EKeysLeap::LeapRightPalmPitch, palmOrientation.Pitch * LEAP_IM_SCALE, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapRightPalmYaw, palmOrientation.Yaw * LEAP_IM_SCALE, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapRightPalmRoll, palmOrientation.Roll * LEAP_IM_SCALE, 0, 0);
} else if (hand.isLeft())
{
ILeapEventInterface::Execute_LeapLeftHandMoved(_private->interfaceDelegate, _private->eventHand);
//Input Mapping
FRotator palmOrientation = _private->eventHand->PalmOrientation;
EmitAnalogInputEventForKey(EKeysLeap::LeapLeftPalmPitch, palmOrientation.Pitch * LEAP_IM_SCALE, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapLeftPalmYaw, palmOrientation.Yaw * LEAP_IM_SCALE, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapLeftPalmRoll, palmOrientation.Roll * LEAP_IM_SCALE, 0, 0);
}
//Grabbing
float grabStrength = hand.grabStrength();
bool grabbed = handClosed(grabStrength);
if (grabbed)
ILeapEventInterface::Execute_LeapHandGrabbing(_private->interfaceDelegate, grabStrength, _private->eventHand);
if (grabbed && !pastHandState.grabbed)
{
ILeapEventInterface::Execute_LeapHandGrabbed(_private->interfaceDelegate, grabStrength, _private->eventHand);
//input mapping
if (_private->eventHand->HandType == LeapHandType::HAND_LEFT)
EmitKeyDownEventForKey(EKeysLeap::LeapLeftGrab, 0, 0);
else
EmitKeyDownEventForKey(EKeysLeap::LeapRightGrab, 0, 0);
}else if (!grabbed && pastHandState.grabbed)
{
ILeapEventInterface::Execute_LeapHandReleased(_private->interfaceDelegate, grabStrength, _private->eventHand);
//input mapping
if (_private->eventHand->HandType == LeapHandType::HAND_LEFT)
EmitKeyUpEventForKey(EKeysLeap::LeapLeftGrab, 0, 0);
else
EmitKeyUpEventForKey(EKeysLeap::LeapRightGrab, 0, 0);
}
//Pinching
float pinchStrength = hand.pinchStrength();
bool pinched = handPinched(pinchStrength);
//While grabbing disable pinching detection, this helps to reduce spam as pose confidence plummets
if (grabbed) pinched = pastHandState.pinched;
//.........这里部分代码省略.........
示例2: ParseEvents
void FLeapMotionInputDevice::ParseEvents()
{
//Optimization: If we don't have any delegates, skip
if (EventDelegates.Num() == 0)
{
return;
}
//Pointers
Leap::Frame Frame = ControllerData.LeapController.frame();
Leap::Frame PastFrame = ControllerData.LeapController.frame(1);
//Calculate HMD Timewarp if valid
if (GEngine->HMDDevice.IsValid() && ControllerData.bTimeWarpEnabled) {
LeapHMDSnapshot ThenSnapshot = HMDSamples->HMDSampleClosestToTimestamp(Frame.timestamp());
LeapHMDSnapshot NowSnapShot = HMDSamples->CurrentHMDSample();
LeapHMDSnapshot HistorySnapshot = HMDSamples->LastHMDSample(); //reduce jitter
//ControllerData.TimeWarpSnapshot = NowSnapShot.Difference(ThenSnapshot, ControllerData.TimeWarpFactor);// * ControllerData.TimeWarpFactor;
FQuat WarpQuat = NowSnapShot.Orientation;//FQuat::Slerp(NowSnapShot.Orientation, HistorySnapshot.Orientation, ControllerData.TimeWarpTween);
FQuat ThenTweened = FQuat::Slerp(ThenSnapshot.Orientation, HistorySnapshot.Orientation, ControllerData.TimeWarpTween);
ControllerData.TimeWarpSnapshot.Orientation = (WarpQuat.Inverse() * ControllerData.TimeWarpFactor) * ThenTweened;
ControllerData.TimeWarpAmountMs = (ControllerData.TimeWarpSnapshot.Timestamp) / 1000.f;
}
//-Hands-
//Hand Count
int HandCount = Frame.hands().count();
if (PastState->HandCount != HandCount)
{
CallFunctionOnDelegates([&](UObject* EventDelegate)
{
ILeapEventInterface::Execute_HandCountChanged(EventDelegate, HandCount);
});
//Zero our input mapping orientations (akin to letting go of a joystick)
if (HandCount == 0)
{
EmitAnalogInputEventForKey(EKeysLeap::LeapLeftPalmPitch, 0, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapLeftPalmYaw, 0, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapLeftPalmRoll, 0, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapRightPalmPitch, 0, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapRightPalmYaw, 0, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapRightPalmRoll, 0, 0, 0);
}
}
//Cycle through each hand
for (int i = 0; i < HandCount; i++)
{
Leap::Hand Hand = Frame.hands()[i];
LeapHandStateData PastHandState = PastState->StateForId(Hand.id()); //we use a custom class to hold reliable state tracking based on id's
//Make a ULeapHand
if (PEventHand == nullptr)
{
PEventHand = NewObject<ULeapHand>();
PEventHand->AddToRoot();
}
PEventHand->SetHand(Hand);
//Emit hand
CallFunctionOnDelegates([&](UObject* EventDelegate)
{
ILeapEventInterface::Execute_LeapHandMoved(EventDelegate, PEventHand);
});
//Left/Right hand forwarding
if (Hand.isRight())
{
CallFunctionOnDelegates([&](UObject* EventDelegate)
{
ILeapEventInterface::Execute_LeapRightHandMoved(EventDelegate, PEventHand);
});
//Input Mapping
FRotator PalmOrientation = PEventHand->PalmOrientation;
EmitAnalogInputEventForKey(EKeysLeap::LeapRightPalmPitch, PalmOrientation.Pitch * LEAP_IM_SCALE, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapRightPalmYaw, PalmOrientation.Yaw * LEAP_IM_SCALE, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapRightPalmRoll, PalmOrientation.Roll * LEAP_IM_SCALE, 0, 0);
}
else if (Hand.isLeft())
{
CallFunctionOnDelegates([&](UObject* EventDelegate)
{
ILeapEventInterface::Execute_LeapLeftHandMoved(EventDelegate, PEventHand);
});
//Input Mapping
FRotator PalmOrientation = PEventHand->PalmOrientation;
EmitAnalogInputEventForKey(EKeysLeap::LeapLeftPalmPitch, PalmOrientation.Pitch * LEAP_IM_SCALE, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapLeftPalmYaw, PalmOrientation.Yaw * LEAP_IM_SCALE, 0, 0);
EmitAnalogInputEventForKey(EKeysLeap::LeapLeftPalmRoll, PalmOrientation.Roll * LEAP_IM_SCALE, 0, 0);
}
//.........这里部分代码省略.........