Hello!
I am working on a project with the Leap Motion toolkit in Unity and am having trouble figuring out a way to set the 'Last Object Touched Adjusted Mass' value of the Contact Bone (Script) when the Right/Left Interaction Hand Contact Bones are created in the scene (when a hand comes into view of the Leap Motion sensor). Currently this value is set to '0' when the Right/Left Interaction hand Contact Bones are created, and I am looking to set this value to something other than 0 (say, '5') when the creation of the contact bones happens.
I've been looking through the code to determine where these values are actually instantiated but am struggling to find how it can be set on creation. I've found the following, which seems to be where the magic happens.
IInteractionBehaviour interactionObj;
if (interactionController.manager.interactionObjectBodies.TryGetValue(collision.rigidbody, out interactionObj)) {
_lastObjectTouchedAdjustedMass = collision.rigidbody.mass;
if (interactionObj is InteractionBehaviour) {
switch ((interactionObj as InteractionBehaviour).contactForceMode) {
case ContactForceMode.UI:
_lastObjectTouchedAdjustedMass *= 2F;
break;
case ContactForceMode.Object:
default:
if (interactionHand != null) {
_lastObjectTouchedAdjustedMass *= 0.2F;
}
else {
_lastObjectTouchedAdjustedMass *= 3F;
}
break;
}
}
I've tried playing with the values in this portion of the code (changing numbers, using += instead of *=, even trying '=' to set the value to a specific number) and have had no luck - the contact fingerbones still spawn into the scene with a 'Last Object Touched Adjusted Mass' of 0.
Am I doing something wrong or looking in the wrong place? This is my first time using the Leap Motion kit and would very much appreciate any help at all.
All the best!