Hello,
I find in document how to use interactive behavior script.
But in this List graspingControllers
Here is full script
using Leap.Unity.Interaction;
using UnityEngine;
namespace Leap.Unity.Interaction {
[RequireComponent(typeof(InteractionBehaviour))]
[RequireComponent(typeof(InteractionController))]
public class InteractionGraspEvents : MonoBehaviour {
private InteractionBehaviour _intObj;
private InteractionController _intObj1;
void Start() {
_intObj = GetComponent();
_intObj1 = GetComponent();
}
private void OnEnable() {
_intObj = GetComponent<InteractionBehaviour>();
_intObj.OnGraspedMovement -= onGraspedMovement; // Prevent double-subscription.
_intObj.OnGraspedMovement += onGraspedMovement;
}
private void OnDisable() {
_intObj.OnGraspedMovement -= onGraspedMovement;
}
private void onGraspedMovement(Vector3 presolvedPos, Quaternion presolvedRot,
Vector3 solvedPos, Quaternion solvedRot,
List<InteractionController> graspingControllers) {
// Project the vector of the motion of the object due to grasping along the world X axis.
Vector3 movementDueToGrasp = solvedPos - presolvedPos;
float xAxisMovement = movementDueToGrasp.x;
// Move the object back to its position before the grasp solve this frame,
// then add just its movement along the world X axis.
_intObj.rigidbody.position = presolvedPos;
_intObj.rigidbody.position += Vector3.right * xAxisMovement;
}
}
}
Please solve my errors.
Thank you
Alpa