VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
GrabbableObjectType.cs
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4 
5 namespace AVR.Phys {
6 
7  /// <summary>
8  /// Defines a set of sounds and modifiers to be played during physics events for GrabbableObjectType's
9  /// </summary>
10  [System.Serializable]
12  {
13  public AudioClip pickupSound;
14  public AudioClip releaseSound;
15  public AudioClip collideSound;
16 
17  //Value from 0 - 1 that the AudioSource will use as a volume multiplier
18  [Range(0, 1)] public float volumeMultiplier;
19  }
20 
21  /// <summary>
22  /// Defines how an object behaves whilst grabbed.
23  /// </summary>
24  [CreateAssetMenu(fileName = "Data", menuName = "arc-vr/phys/GrabbableObjectType", order = 1)]
25  public class GrabbableObjectType : ScriptableObject
26  {
27  public enum FollowType { FREE, STATIC, CONSTRAINED, HEAVY };
28  public FollowType followType;
29 
30  public bool handToObject = false;
31 
32  public bool allowTwoHanded = false;
35 
36  [Range(0.0f, 1.0f)]
37  public float Lightness = 1.0f;
38  [Range(0.0f, 1.0f)]
39  public float Angular_Lightness = 1.0f;
40 
41  [Range(0.05f, 2.0f)]
42  public float Break_grab_distance = 0.5f;
43 
44  // This multiplier will essentially make the target objects rigidbody weight = weight * 1.0/multiplier
45  public float Heavy_force_multiplier = 1.0f;
46 
48 
51  o.followType = FollowType.FREE;
52  o.handToObject = false;
53  o.allowTwoHanded = false;
54  o.changeObjectTypeOnTwoHanded = false;
55  o.Lightness = 1.0f;
56  o.Angular_Lightness = 1.0f;
57  o.Break_grab_distance = 0.5f;
58  o.soundData.pickupSound = null;
59  o.soundData.releaseSound = null;
60  o.soundData.collideSound = null;
61  o.soundData.volumeMultiplier = 1.0f;
62 
63  return o;
64  }
65 
66  //When the user resets the scriptable object in the inspector, give them a default object.
67  private void Reset()
68  {
69  followType = FollowType.FREE;
70  handToObject = false;
71  allowTwoHanded = false;
72  changeObjectTypeOnTwoHanded = false;
73  Lightness = 1.0f;
74  Angular_Lightness = 1.0f;
75  Break_grab_distance = 0.5f;
76  soundData.pickupSound = null;
77  soundData.releaseSound = null;
78  soundData.collideSound = null;
79  soundData.volumeMultiplier = 1.0f;
80  }
81  }
82 }
static GrabbableObjectType defaultObjectType()
Defines how an object behaves whilst grabbed.
Defines a set of sounds and modifiers to be played during physics events for GrabbableObjectType's ...
GrabbableObjectType typeOnTwoHanded
GrabbableObjectSoundData soundData