Skip to main content

Class BhapticsPhysicsGlove

Inherits from MonoBehaviour

Class BhapticsPhysicsGlove contains the functions for using haptic devices from bHaptics.

note

fingerIndex accepts 0 - 5 on TactGlove DK2 and 0 - 7 on TactGlove DK3.

Passing 6 or 7 while a TactGlove DK2 is connected does not throw an exception. See TactGlove DK2 and DK3 Compatibility for how the same feedback plays on either glove.


Public Methods​

SendEnterHaptic​

public void SendEnterHaptic(bool isLeft, int fingerIndex);
public void SendEnterHaptic(bool isLeft, int fingerIndex, Collision collision);
public void SendEnterHaptic(bool isLeft, int fingerIndex, Vector3 velocity);
public void SendEnterHaptic(PositionType position, int fingerIndex);
public void SendEnterHaptic(PositionType position, int fingerIndex, Collision collision);
public void SendEnterHaptic(PositionType position, int fingerIndex, Vector3 velocity);

Sends enter haptic feedback. Use when the hand has begun touching something such as OnCollisionEnter in Collider.

Declaration​

public void SendEnterHaptic(bool isLeft, int fingerIndex);
public void SendEnterHaptic(PositionType position, int fingerIndex);

Description​

Sends enter haptic feedback based on the maximum velocity change setting.

Parameters​

  • bool isLeft: Indicates if the left glove is used.
  • PositionType position: Type of bHaptics device.
    • PositionType.GloveL (== 8)
    • PositionType.GloveR (== 9)
  • int fingerIndex: Index of the finger, wrist, or palm.
    • 0: Thumb Tip
    • 1: Index Tip
    • 2: Middle Tip
    • 3: Ring Tip
    • 4: Little Tip
    • 5: Wrist
    • 6: Palm (thumb side) — TactGlove DK3 only
    • 7: Palm (little finger side) — TactGlove DK3 only

Example​

using Bhaptics.SDK2;
using Bhaptics.SDK2.Glove;

public class Example : MonoBehaviour
{
public int fingerIndex;
public bool isLeft;

private void OnCollisionEnter(Collision collision)
{
// If isLeft is true and fingerIndex is 1, then feedback will come to the index finger of the left glove.
BhapticsPhysicsGlove.Instance.SendEnterHaptic(isLeft, fingerIndex);
// OR
BhapticsPhysicsGlove.Instance.SendEnterHaptic(isLeft ? PositionType.GloveL : PositionType.GloveR, fingerIndex);
}
}

Declaration​

public void SendEnterHaptic(bool isLeft, int fingerIndex, Collision collision);
public void SendEnterHaptic(PositionType position, int fingerIndex, Collision collision);

Description​

Sends enter haptic feedback based on the relative velocity from the collision data.

Parameters​

  • bool isLeft: Indicates if the left glove is used.
  • PositionType position: Type of bHaptics device.
    • PositionType.GloveL (== 8)
    • PositionType.GloveR (== 9)
  • int fingerIndex: Index of the finger, wrist, or palm.
    • 0: Thumb Tip
    • 1: Index Tip
    • 2: Middle Tip
    • 3: Ring Tip
    • 4: Little Tip
    • 5: Wrist
    • 6: Palm (thumb side) — TactGlove DK3 only
    • 7: Palm (little finger side) — TactGlove DK3 only
  • Collision collision: Collision data

Example​

using Bhaptics.SDK2;
using Bhaptics.SDK2.Glove;

public class Example : MonoBehaviour
{
public int fingerIndex;
public bool isLeft;

private void OnCollisionEnter(Collision collision)
{
// If isLeft is true and fingerIndex is 1, then feedback based on the relative velocity of the collision to the index finger of the left glove.
BhapticsPhysicsGlove.Instance.SendEnterHaptic(isLeft, fingerIndex, collision);
// OR
BhapticsPhysicsGlove.Instance.SendEnterHaptic(isLeft ? PositionType.GloveL : PositionType.GloveR, fingerIndex, collision);
}
}

Declaration​

public void SendEnterHaptic(bool isLeft, int fingerIndex, Vector3 velocity);
public void SendEnterHaptic(PositionType position, int fingerIndex, Vector3 velocity);

Description​

Sends enter haptic feedback based on the provided velocity data.

Parameters​

  • bool isLeft: Indicates if the left glove is used.
  • PositionType position: Type of bHaptics device.
    • PositionType.GloveL (== 8)
    • PositionType.GloveR (== 9)
  • int fingerIndex: Index of the finger, wrist, or palm.
    • 0: Thumb Tip
    • 1: Index Tip
    • 2: Middle Tip
    • 3: Ring Tip
    • 4: Little Tip
    • 5: Wrist
    • 6: Palm (thumb side) — TactGlove DK3 only
    • 7: Palm (little finger side) — TactGlove DK3 only
  • Vector3 velocity: Velocity data

Example​

using Bhaptics.SDK2;
using Bhaptics.SDK2.Glove;

public class Example : MonoBehaviour
{
public int fingerIndex;
public bool isLeft;

private void OnCollisionEnter(Collision collision)
{
// If isLeft is true and fingerIndex is 1, then feedback will come to the index finger of the left glove based on velocity data.
BhapticsPhysicsGlove.Instance.SendEnterHaptic(isLeft, fingerIndex, collision.relativeVelocity);
// OR
BhapticsPhysicsGlove.Instance.SendEnterHaptic(isLeft ? PositionType.GloveL : PositionType.GloveR, fingerIndex, collision.relativeVelocity);
}
}

SendStayHaptic​

public void SendStayHaptic(bool isLeft, int fingerIndex);
public void SendStayHaptic(bool isLeft, int fingerIndex, Transform slaveTransform, Transform masterTransform);
public void SendStayHaptic(bool isLeft, int fingerIndex, float relativeDistance);
public void SendStayHaptic(PositionType position, int fingerIndex);
public void SendStayHaptic(PositionType position, int fingerIndex, Transform slaveTransform, Transform masterTransform);
public void SendStayHaptic(PositionType position, int fingerIndex, float relativeDistance);

Sends stay haptic feedback. Use when the hand keep touching something such as OnCollisionStay in Collider.

Declaration​

public void SendStayHaptic(bool isLeft, int fingerIndex);
public void SendStayHaptic(PositionType position, int fingerIndex);

Description​

Sends stay haptic feedback based on the maximum velocity change setting.

Parameters​

  • bool isLeft: Indicates if the left glove is used.
  • PositionType position: Type of bHaptics device.
    • PositionType.GloveL (== 8)
    • PositionType.GloveR (== 9)
  • int fingerIndex: Index of the finger, wrist, or palm.
    • 0: Thumb Tip
    • 1: Index Tip
    • 2: Middle Tip
    • 3: Ring Tip
    • 4: Little Tip
    • 5: Wrist
    • 6: Palm (thumb side) — TactGlove DK3 only
    • 7: Palm (little finger side) — TactGlove DK3 only

Example​

using Bhaptics.SDK2;
using Bhaptics.SDK2.Glove;

public class Example : MonoBehaviour
{
public int fingerIndex;
public bool isLeft;

private void OnCollisionStay(Collision collision)
{
// If isLeft is true and fingerIndex is 1, then feedback will come to the index finger of the left glove.
BhapticsPhysicsGlove.Instance.SendStayHaptic(isLeft, fingerIndex);
// OR
BhapticsPhysicsGlove.Instance.SendStayHaptic(isLeft ? PositionType.GloveL : PositionType.GloveR, fingerIndex);
}
}

Declaration​

public void SendStayHaptic(bool isLeft, int fingerIndex, Transform slaveTransform, Transform masterTransform);
public void SendStayHaptic(PositionType position, int fingerIndex, Transform slaveTransform, Transform masterTransform);

Description​

Sends stay haptic feedback with transform data.

Parameters​

  • bool isLeft: Indicates if the left glove is used.
  • PositionType position: Type of bHaptics device.
    • PositionType.GloveL (== 8)
    • PositionType.GloveR (== 9)
  • int fingerIndex: Index of the finger, wrist, or palm.
    • 0: Thumb Tip
    • 1: Index Tip
    • 2: Middle Tip
    • 3: Ring Tip
    • 4: Little Tip
    • 5: Wrist
    • 6: Palm (thumb side) — TactGlove DK3 only
    • 7: Palm (little finger side) — TactGlove DK3 only
  • Transform slaveTransform: Slave transform data.
  • Transform masterTransform: Master transform data.

Example​

using Bhaptics.SDK2;
using Bhaptics.SDK2.Glove;

public class Example : MonoBehaviour
{
public int fingerIndex;
public bool isLeft;
public Transform masterTransform;

private void OnCollisionStay(Collision collision)
{
// If isLeft is true and fingerIndex is 1, then feedback based on the relative velocity of the collision to the index finger of the left glove.
BhapticsPhysicsGlove.Instance.SendStayHaptic(isLeft, fingerIndex, transform, masterTransform);
// OR
BhapticsPhysicsGlove.Instance.SendStayHaptic(isLeft ? PositionType.GloveL : PositionType.GloveR, fingerIndex, transform, masterTransform);
}
}

Declaration​

public void SendStayHaptic(bool isLeft, int fingerIndex, float relativeDistance);
public void SendStayHaptic(PositionType position, int fingerIndex, float relativeDistance);

Description​

Sends stay haptic feedback based on the provided velocity data.

Parameters​

  • bool isLeft: Indicates if the left glove is used.
  • PositionType position: Type of bHaptics device.
    • PositionType.GloveL (== 8)
    • PositionType.GloveR (== 9)
  • int fingerIndex: Index of the finger, wrist, or palm.
    • 0: Thumb Tip
    • 1: Index Tip
    • 2: Middle Tip
    • 3: Ring Tip
    • 4: Little Tip
    • 5: Wrist
    • 6: Palm (thumb side) — TactGlove DK3 only
    • 7: Palm (little finger side) — TactGlove DK3 only
  • float relativeDistance: Relative distance data.

Example​

using Bhaptics.SDK2;
using Bhaptics.SDK2.Glove;

public class Example : MonoBehaviour
{
public int fingerIndex;
public bool isLeft;
public float distance;

private void OnCollisionStay(Collision collision)
{
// If isLeft is true and fingerIndex is 1, then feedback will come to the index finger of the left glove based on velocity data.
BhapticsPhysicsGlove.Instance.SendStayHaptic(isLeft, fingerIndex, distance);
// OR
BhapticsPhysicsGlove.Instance.SendStayHaptic(isLeft ? PositionType.GloveL : PositionType.GloveR , fingerIndex, distance);
}
}

SendExitHaptic​

public void SendExitHaptic(bool isLeft, int fingerIndex);
public void SendExitHaptic(PositionType position, int fingerIndex);

Sends exit haptic feedback based on the maximum velocity change setting.

Parameters​

  • bool isLeft: Indicates if the left glove is used.
  • PositionType position: Type of bHaptics device.
    • PositionType.GloveL (== 8)
    • PositionType.GloveR (== 9)
  • int fingerIndex: Index of the finger, wrist, or palm.
    • 0: Thumb Tip
    • 1: Index Tip
    • 2: Middle Tip
    • 3: Ring Tip
    • 4: Little Tip
    • 5: Wrist
    • 6: Palm (thumb side) — TactGlove DK3 only
    • 7: Palm (little finger side) — TactGlove DK3 only

Example​

using Bhaptics.SDK2;
using Bhaptics.SDK2.Glove;

public class Example : MonoBehaviour
{
public int fingerIndex;
public bool isLeft;

private void OnCollisionExit(Collision collision)
{
// If isLeft is true and fingerIndex is 1, then feedback will come to the index finger of the left glove.
BhapticsPhysicsGlove.Instance.SendExitHaptic(isLeft, fingerIndex);
// OR
BhapticsPhysicsGlove.Instance.SendExitHaptic(isLeft ? PositionType.GloveL : PositionType.GloveR, fingerIndex);
}
}

ChangeHapticMode​

public void ChangeHapticMode(BhapticsPhysicsGloveSettings.HapticMode mode);

Changes the haptic mode. For more information about modes, refer to BhapticsPhysicsGloveSettings.HapticMode page.

note

Inherited members from MonoBehaviour can be found in Unity References.