Interhaptics SDK for Unity 1.6
Loading...
Searching...
No Matches
Interhaptics.Samples.XRControllerHapticSource Class Reference
Inheritance diagram for Interhaptics.Samples.XRControllerHapticSource:
Interhaptics.SpatialHapticSource Interhaptics.Internal.HapticSource

Public Member Functions

IEnumerator XRControlVibration (GameObject hbp)
 
- Public Member Functions inherited from Interhaptics.SpatialHapticSource
override void PlayEventVibration ()
 Method to start the coroutine from outside (if necessary). Plays the haptic effect after the vibrationOffset.
 
override IEnumerator ControlVibration ()
 Controls the vibration perception based on the full length of the haptic material; stops any residual haptics which might come from the controller after the haptic playback length.
 
void AddTarget (GameObject target)
 
void RemoveTarget (GameObject target)
 
- Public Member Functions inherited from Interhaptics.Internal.HapticSource
virtual void ApplyTargetIntensity ()
 
void ApplySourceIntensity ()
 Call this method to apply the source intensity.
 
void ApplyLooping (int loopValue)
 Call this method to apply the looping state.
 
void DebugMode (string debugMessage)
 Debug method to print messages in the console only when debugMode is enabled.
 
virtual void Play ()
 Call this method to play the haptic effect.
 
virtual void Stop ()
 Call this method to stop the haptic effect.
 
void AddTarget (List< HapticBodyMapping.CommandData > Target)
 Call this method to add a target to the haptic effect.
 
void RemoveTarget (List< HapticBodyMapping.CommandData > Target)
 Call this method to remove a target from the haptic effect.
 

Protected Member Functions

override void Start ()
 Initialize the haptic effect settings at the start of the game.
 
override void OnCollisionEnter (Collision other)
 
override void OnTriggerEnter (Collider other)
 
override void OnTriggerExit (Collider other)
 
override void OnCollisionExit (Collision other)
 
- Protected Member Functions inherited from Interhaptics.Internal.HapticSource
virtual void Awake ()
 Add the haptic effect file to the when the object is created. The haptic effect file can be in the StreamingAssets folder if the useStreamingAssets property is set to true.
 
virtual void Update ()
 Update the haptic effect settings at every frame.
 

Additional Inherited Members

- Public Types inherited from Interhaptics.SpatialHapticSource
enum  PlayMethod { Undefined , OnCollision , OnTrigger }
 
- Public Attributes inherited from Interhaptics.SpatialHapticSource
PlayMethod playMethod
 
- Public Attributes inherited from Interhaptics.Internal.HapticSource
HapticMaterial hapticMaterial
 
bool useStreamingAssets = false
 
string hapticEffectStreamingAssetsPath
 
float vibrationOffset
 
bool debugMode
 
bool isLooping
 
int maxLoops = 1
 
float maxLoopTime = 10f
 
double targetIntensity = 1.0
 
bool playAtStart = false
 
bool isPlaying = false
 
double hapticEffectDuration = 0
 
Coroutine playingCoroutine = null
 
double loopStartTime = 0
 
- Static Public Attributes inherited from Interhaptics.Internal.HapticSource
const string ERROR_MESSAGE_MONO = "Interhaptics requires IL2CPP scripting backend for Android. Please change it in Player Settings. Haptics will not play on the Mono scripting backend on the Android platform."
 
- Properties inherited from Interhaptics.Internal.HapticSource
int HapticMaterialId [get, set]
 
float SourceIntensity [get, set]
 

Detailed Description

Definition at line 13 of file XRControllerHapticSource.cs.

Member Function Documentation

◆ OnCollisionEnter()

override void Interhaptics.Samples.XRControllerHapticSource.OnCollisionEnter ( Collision other)
protectedvirtual

Reimplemented from Interhaptics.SpatialHapticSource.

Definition at line 42 of file XRControllerHapticSource.cs.

43 {
44 DebugMode("Collision:" + hapticEffectDuration + other.gameObject);
45 ActivateHaptics(other.gameObject);
46 }
void DebugMode(string debugMessage)
Debug method to print messages in the console only when debugMode is enabled.

References Interhaptics.Internal.HapticSource.DebugMode(), and Interhaptics.Internal.HapticSource.hapticEffectDuration.

◆ OnCollisionExit()

override void Interhaptics.Samples.XRControllerHapticSource.OnCollisionExit ( Collision other)
protectedvirtual

Reimplemented from Interhaptics.SpatialHapticSource.

Definition at line 78 of file XRControllerHapticSource.cs.

79 {
80 if (stopHapticsExitTriggerCollision)
81 {
82 RemoveTarget(other.gameObject);
83 }
84 }
void RemoveTarget(GameObject target)

References Interhaptics.SpatialHapticSource.RemoveTarget().

◆ OnTriggerEnter()

override void Interhaptics.Samples.XRControllerHapticSource.OnTriggerEnter ( Collider other)
protectedvirtual

Reimplemented from Interhaptics.SpatialHapticSource.

Definition at line 48 of file XRControllerHapticSource.cs.

49 {
50 DebugMode("Trigger:" + hapticEffectDuration + other.gameObject);
51 ActivateHaptics(other.gameObject);
52 }

References Interhaptics.Internal.HapticSource.DebugMode(), and Interhaptics.Internal.HapticSource.hapticEffectDuration.

◆ OnTriggerExit()

override void Interhaptics.Samples.XRControllerHapticSource.OnTriggerExit ( Collider other)
protectedvirtual

Reimplemented from Interhaptics.SpatialHapticSource.

Definition at line 70 of file XRControllerHapticSource.cs.

71 {
72 if (stopHapticsExitTriggerCollision)
73 {
74 RemoveTarget(other.gameObject);
75 }
76 }

References Interhaptics.SpatialHapticSource.RemoveTarget().

◆ Start()

override void Interhaptics.Samples.XRControllerHapticSource.Start ( )
protectedvirtual

Initialize the haptic effect settings at the start of the game.

Reimplemented from Interhaptics.SpatialHapticSource.

Definition at line 28 of file XRControllerHapticSource.cs.

29 {
30 base.Start();
31 }

◆ XRControlVibration()

IEnumerator Interhaptics.Samples.XRControllerHapticSource.XRControlVibration ( GameObject hbp)

Definition at line 33 of file XRControllerHapticSource.cs.

34 {
35 DebugMode(string.Format("Started playing haptics! + {0}", Time.time));
36 Play();
37 yield return new WaitForSeconds((float)hapticEffectDuration);
38 RemoveTarget(hbp);
39 DebugMode(string.Format("Finished playing haptics at timestamp : + {0} at {1}", hapticEffectDuration, Time.time));
40 }
virtual void Play()
Call this method to play the haptic effect.

References Interhaptics.Internal.HapticSource.DebugMode(), Interhaptics.Internal.HapticSource.hapticEffectDuration, Interhaptics.Internal.HapticSource.Play(), and Interhaptics.SpatialHapticSource.RemoveTarget().


The documentation for this class was generated from the following file: