Skip to content

Commit

Permalink
Fix source pose not filtering for source ID (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
FejZa committed Jul 17, 2024
1 parent c866293 commit 5ffc2e3
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Runtime/Input/Controllers/BaseControllerVisualizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ public Transform GripPose
/// <inheritdoc />
public override void OnSourcePoseChanged(SourcePoseEventData<Pose> eventData)
{
SourcePose = eventData.SourceData;
if (eventData.SourceId == Controller?.InputSource.SourceId)
{
SourcePose = eventData.SourceData;
}

if (OverrideSourcePose)
{
Expand All @@ -57,7 +60,10 @@ public override void OnSourcePoseChanged(SourcePoseEventData<Pose> eventData)
/// <inheritdoc />
public override void OnSourcePoseChanged(SourcePoseEventData<Quaternion> eventData)
{
SourcePose = new Pose(SourcePose.position, eventData.SourceData);
if (eventData.SourceId == Controller?.InputSource.SourceId)
{
SourcePose = new Pose(SourcePose.position, eventData.SourceData);
}

if (OverrideSourcePose)
{
Expand All @@ -70,7 +76,10 @@ public override void OnSourcePoseChanged(SourcePoseEventData<Quaternion> eventDa
/// <inheritdoc />
public override void OnSourcePoseChanged(SourcePoseEventData<Vector2> eventData)
{
SourcePose = new Pose(eventData.SourceData, SourcePose.rotation);
if (eventData.SourceId == Controller?.InputSource.SourceId)
{
SourcePose = new Pose(eventData.SourceData, SourcePose.rotation);
}

if (OverrideSourcePose)
{
Expand All @@ -83,7 +92,10 @@ public override void OnSourcePoseChanged(SourcePoseEventData<Vector2> eventData)
/// <inheritdoc />
public override void OnSourcePoseChanged(SourcePoseEventData<Vector3> eventData)
{
SourcePose = new Pose(eventData.SourceData, SourcePose.rotation);
if (eventData.SourceId == Controller?.InputSource.SourceId)
{
SourcePose = new Pose(eventData.SourceData, SourcePose.rotation);
}

if (OverrideSourcePose)
{
Expand Down

0 comments on commit 5ffc2e3

Please sign in to comment.