Skip to content

Exitpoll Event Name Update & Pointer Offset Support #238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

parisacognitive3d
Copy link
Contributor

@parisacognitive3d parisacognitive3d commented Jul 9, 2025

Description

The following changes are made to improve the ExitPoll system:

  • Renamed the event from cvr.exitpoll to c3d.exitpoll
  • Added support for user-defined position and rotation offsets on the controller pointer, allowing better alignment for different platforms and use cases
  • Exposed offset fields in the ExitPollHolder inspector

Linear Issue ID(s) (If applicable): SDK-71

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist

  • My changes will not interrupt or disrupt automated build processes
  • I have checked all outgoing links (i.e. to documentation) for validity
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • I have assigned this PR to myself in GitHub
  • I have assigned and notified Reviewers for this PR

@parisacognitive3d parisacognitive3d self-assigned this Jul 9, 2025
@parisacognitive3d parisacognitive3d marked this pull request as ready for review July 9, 2025 16:51
Copy link

@alfred316 alfred316 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matt-manuel matt-manuel requested a review from Copilot July 15, 2025 16:03
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR renames the exit poll event and adds configurable position and rotation offsets for the controller pointer.

  • Renamed the custom event ID from cvr.exitpoll to c3d.exitpoll.
  • Introduced PointerPositionOffset and PointerRotationOffset parameters, exposed them in the inspector, and applied them in the pointer handler.
  • Updated the controller pointer setup and exit poll invocation to include the new offset parameters.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
PointerInputHandler.cs Added static offset fields and applied them in HandleControllerInput
ExitPollSet.cs Updated log message; passed new offset parameters to pointer setup
ExitPollPointer.cs Extended SetupControllerAsPointer signature and assigned offsets
ExitPollParameters.cs Added PointerPositionOffset and PointerRotationOffset fields
ExitPollManager.cs Renamed custom event string to "c3d.exitpoll"
ExitPollHolder.cs Removed obsolete session-end cleanup subscription and method
Editor/ExitPollHolderInspector.cs Exposed pointer offset fields in the custom inspector
Comments suppressed due to low confidence (1)

Runtime/ExitPoll/Scripts/ExitPollHolder.cs:18

  • The session-end event subscription and corresponding Cleanup method were removed, so ExitPollHolder no longer performs cleanup when the session ends. Ensure cleanup logic is relocated or re-added to prevent leftover UI elements or memory leaks.
        {

Comment on lines +55 to +56
if (positionOffset != Vector3.zero) PointerInputHandler.PointerPosOffset = positionOffset;
if (rotationOffset != Vector3.zero) PointerInputHandler.PointerRotOffset = rotationOffset;
Copy link
Preview

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditional check prevents resetting the pointer position offset back to zero, which can leave stale offsets in place. Always assign the offset field regardless of its value so zero offsets are correctly applied.

Suggested change
if (positionOffset != Vector3.zero) PointerInputHandler.PointerPosOffset = positionOffset;
if (rotationOffset != Vector3.zero) PointerInputHandler.PointerRotOffset = rotationOffset;
PointerInputHandler.PointerPosOffset = positionOffset;
PointerInputHandler.PointerRotOffset = rotationOffset;

Copilot uses AI. Check for mistakes.

@@ -52,6 +52,8 @@ internal static void SetupControllerAsPointer(GameObject pointerPrefab, ExitPoll
pointerInstance.transform.localRotation = Quaternion.identity;
if (pointerInstance.GetComponent<PointerInputHandler>())
{
if (positionOffset != Vector3.zero) PointerInputHandler.PointerPosOffset = positionOffset;
if (rotationOffset != Vector3.zero) PointerInputHandler.PointerRotOffset = rotationOffset;
Copy link
Preview

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditional check prevents resetting the pointer rotation offset back to zero, which can leave stale offsets in place. Always assign the offset field regardless of its value so zero offsets are correctly applied.

Suggested change
if (rotationOffset != Vector3.zero) PointerInputHandler.PointerRotOffset = rotationOffset;
PointerInputHandler.PointerRotOffset = rotationOffset;

Copilot uses AI. Check for mistakes.

Comment on lines +34 to +40
public static Vector3 PointerPosOffset;

/// <summary>
/// Local rotation offset (in degrees) applied to the controller pointer direction.
/// Useful for fine-tuning the pointer's forward angle when it doesn't align with the controller's default forward direction.
/// </summary>
public static Vector3 PointerRotOffset;
Copy link
Preview

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Declaring offset fields as static means all PointerInputHandler instances share the same values, which could conflict if multiple pointers need different offsets. Consider making these instance fields instead.

Suggested change
public static Vector3 PointerPosOffset;
/// <summary>
/// Local rotation offset (in degrees) applied to the controller pointer direction.
/// Useful for fine-tuning the pointer's forward angle when it doesn't align with the controller's default forward direction.
/// </summary>
public static Vector3 PointerRotOffset;
public Vector3 PointerPosOffset;
/// <summary>
/// Local rotation offset (in degrees) applied to the controller pointer direction.
/// Useful for fine-tuning the pointer's forward angle when it doesn't align with the controller's default forward direction.
/// </summary>
public Vector3 PointerRotOffset;

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants