-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
166 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using UnityEngine; | ||
using Signals.Common; | ||
|
||
|
||
|
||
namespace Signals.Utils | ||
{ | ||
/// <summary> | ||
/// Tracks the rotation of a GameObject in euler angles. | ||
/// </summary> | ||
[AddComponentMenu("Signals/Utils/EulerAnglesTracker")] | ||
public class EulerAnglesTracker : MonoBehaviour | ||
{ | ||
[SerializeField] Vector3Signal _signal; | ||
[SerializeField] bool _local; | ||
Transform _transform; | ||
|
||
/// <summary> | ||
/// The signal that keeps track of the rotation. | ||
/// </summary> | ||
public Vector3Signal Signal | ||
{ | ||
get | ||
{ | ||
return _signal; | ||
} | ||
|
||
set | ||
{ | ||
_signal = value; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// True to track local instead of global rotation. | ||
/// </summary> | ||
public bool Local | ||
{ | ||
get | ||
{ | ||
return _local; | ||
} | ||
|
||
set | ||
{ | ||
_local = value; | ||
} | ||
} | ||
|
||
void Start() | ||
{ | ||
_transform = transform; | ||
} | ||
|
||
void Update() | ||
{ | ||
if(_signal) _signal.Value = _local ? _transform.localEulerAngles : _transform.eulerAngles; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using UnityEngine; | ||
using Signals.Common; | ||
|
||
|
||
|
||
namespace Signals.Utils | ||
{ | ||
/// <summary> | ||
/// Tracks the rotation of a GameObject. | ||
/// </summary> | ||
[AddComponentMenu("Signals/Utils/RotationTracker")] | ||
public class RotationTracker : MonoBehaviour | ||
{ | ||
[SerializeField] QuaternionSignal _signal; | ||
[SerializeField] bool _local; | ||
Transform _transform; | ||
|
||
/// <summary> | ||
/// The signal that keeps track of the rotation. | ||
/// </summary> | ||
public QuaternionSignal Signal | ||
{ | ||
get | ||
{ | ||
return _signal; | ||
} | ||
|
||
set | ||
{ | ||
_signal = value; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// True to track local instead of global rotation. | ||
/// </summary> | ||
public bool Local | ||
{ | ||
get | ||
{ | ||
return _local; | ||
} | ||
|
||
set | ||
{ | ||
_local = value; | ||
} | ||
} | ||
|
||
void Start() | ||
{ | ||
_transform = transform; | ||
} | ||
|
||
void Update() | ||
{ | ||
if(_signal) _signal.Value = _local ? _transform.localRotation : _transform.rotation; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.