-
Notifications
You must be signed in to change notification settings - Fork 2
add EditorPlayerController closes #97 #100
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
Conversation
There was a problem hiding this 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 adds an EditorPlayerController for STYLY XR Rig that enables WASD movement and mouse-look controls specifically for Unity Editor runtime testing. The controller provides a traditional FPS-style control scheme to navigate the XR environment during development.
- Implemented WASD movement with E/Q for vertical movement
- Added right-mouse-button look controls with sensitivity settings
- Created editor-only functionality that compiles out for builds
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| EditorPlayerController.cs | Main controller script with movement and rotation logic |
| EditorPlayerController.cs.meta | Unity metadata file for the new script |
| STYLY XR Rig.prefab | Updated prefab to include the EditorPlayerController component |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // Rotate only while right-clicking | ||
| if (mouse.rightButton.isPressed) | ||
| { | ||
| Vector2 mouseDelta = mouse.delta.ReadValue() * lookSensitivity * 0.1f; |
Copilot
AI
Aug 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number 0.1f should be extracted to a named constant or configurable field to make the sensitivity scaling more transparent and maintainable.
| Vector2 mouseDelta = mouse.delta.ReadValue() * lookSensitivity * 0.1f; | |
| Vector2 mouseDelta = mouse.delta.ReadValue() * lookSensitivity * mouseSensitivityScale; |
| rotationX -= mouseDelta.y; | ||
|
|
||
| // Vertical angle limit | ||
| rotationX = Mathf.Clamp(rotationX, -90f, 90f); |
Copilot
AI
Aug 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The vertical rotation limits (-90f, 90f) should be extracted to configurable fields or constants to allow customization of the look angle constraints.
| rotationX = Mathf.Clamp(rotationX, -90f, 90f); | |
| rotationX = Mathf.Clamp(rotationX, minVerticalAngle, maxVerticalAngle); |
|
This PR also attaches scripts to STYLY XR Rig/_Added/XRRigManager. |
# Conflicts: # Packages/com.styly.styly-xr-rig/Runtime/STYLY XR Rig.prefab
b7c6cb5 to
b926486
Compare
Implemented WASD movement, Y-axis movement in UE, and direction changes while holding the right mouse button only during UnityEditor runtime.
There might be more appropriate class names available.