Skip to content

Conversation

@hacha
Copy link
Collaborator

@hacha hacha commented Aug 27, 2025

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.

@hacha hacha requested review from afjk and Copilot August 27, 2025 10:22
Copy link
Contributor

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 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;
Copy link

Copilot AI Aug 27, 2025

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.

Suggested change
Vector2 mouseDelta = mouse.delta.ReadValue() * lookSensitivity * 0.1f;
Vector2 mouseDelta = mouse.delta.ReadValue() * lookSensitivity * mouseSensitivityScale;

Copilot uses AI. Check for mistakes.
rotationX -= mouseDelta.y;

// Vertical angle limit
rotationX = Mathf.Clamp(rotationX, -90f, 90f);
Copy link

Copilot AI Aug 27, 2025

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.

Suggested change
rotationX = Mathf.Clamp(rotationX, -90f, 90f);
rotationX = Mathf.Clamp(rotationX, minVerticalAngle, maxVerticalAngle);

Copilot uses AI. Check for mistakes.
@from2001
Copy link
Collaborator

@hacha Thank you for the implementation.

@afjk This script needs to be attached to the Rig. So we need to merge #95 first.

@hacha
Copy link
Collaborator Author

hacha commented Aug 27, 2025

This PR also attaches scripts to STYLY XR Rig/_Added/XRRigManager.

hacha and others added 2 commits August 29, 2025 18:07
# Conflicts:
#	Packages/com.styly.styly-xr-rig/Runtime/STYLY XR Rig.prefab
@afjk afjk force-pushed the feat/WASD-contoller-in-UnityEditor branch from b7c6cb5 to b926486 Compare August 29, 2025 09:15
@afjk afjk merged commit 471e1b9 into develop Aug 29, 2025
@afjk afjk deleted the feat/WASD-contoller-in-UnityEditor branch August 29, 2025 09:19
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