@@ -5,38 +5,38 @@ namespace WebXR.Interactions
5
5
[ RequireComponent ( typeof ( Rigidbody ) ) ]
6
6
public class MouseDragObject : MonoBehaviour
7
7
{
8
- private Camera currentCamera ;
9
- private new Rigidbody rigidbody ;
10
- private Vector3 screenPoint ;
11
- private Vector3 offset ;
8
+ private Camera m_currentCamera ;
9
+ private Rigidbody m_rigidbody ;
10
+ private Vector3 m_screenPoint ;
11
+ private Vector3 m_offset ;
12
12
13
13
void Awake ( )
14
14
{
15
- rigidbody = GetComponent < Rigidbody > ( ) ;
15
+ m_rigidbody = GetComponent < Rigidbody > ( ) ;
16
16
}
17
17
18
18
void OnMouseDown ( )
19
19
{
20
- currentCamera = FindCamera ( ) ;
21
- if ( currentCamera != null )
20
+ m_currentCamera = FindCamera ( ) ;
21
+ if ( m_currentCamera != null )
22
22
{
23
- screenPoint = currentCamera . WorldToScreenPoint ( gameObject . transform . position ) ;
24
- offset = gameObject . transform . position - currentCamera . ScreenToWorldPoint ( GetMousePosWithScreenZ ( screenPoint . z ) ) ;
23
+ m_screenPoint = m_currentCamera . WorldToScreenPoint ( gameObject . transform . position ) ;
24
+ m_offset = gameObject . transform . position - m_currentCamera . ScreenToWorldPoint ( GetMousePosWithScreenZ ( m_screenPoint . z ) ) ;
25
25
}
26
26
}
27
27
28
28
void OnMouseUp ( )
29
29
{
30
- currentCamera = null ;
30
+ m_currentCamera = null ;
31
31
}
32
32
33
33
void FixedUpdate ( )
34
34
{
35
- if ( currentCamera != null )
35
+ if ( m_currentCamera != null )
36
36
{
37
- Vector3 currentScreenPoint = GetMousePosWithScreenZ ( screenPoint . z ) ;
38
- rigidbody . velocity = Vector3 . zero ;
39
- rigidbody . MovePosition ( currentCamera . ScreenToWorldPoint ( currentScreenPoint ) + offset ) ;
37
+ Vector3 currentScreenPoint = GetMousePosWithScreenZ ( m_screenPoint . z ) ;
38
+ m_rigidbody . velocity = Vector3 . zero ;
39
+ m_rigidbody . MovePosition ( m_currentCamera . ScreenToWorldPoint ( currentScreenPoint ) + m_offset ) ;
40
40
}
41
41
}
42
42
0 commit comments