-
Notifications
You must be signed in to change notification settings - Fork 26
fix: incorrect handling of viewpoints in GenericPlatform #642
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 fixes the incorrect handling of viewpoint coordinates by removing the local space conversion and directly assigning world coordinates.
- Removed InverseTransformPoint usage in Assigning EyePosition in ExtractCommonAvatarInfo.
- Removed InverseTransformPoint in InitEyePosition to set viewpoint.transform.position directly.
Editor/Platform/GenericPlatform.cs
Outdated
@@ -46,7 +46,7 @@ public CommonAvatarInfo ExtractCommonAvatarInfo(GameObject avatarRoot) | |||
throw new InvalidOperationException("Multiple NDMF Viewpoint components found"); | |||
} | |||
|
|||
cai.EyePosition = avatarRoot.transform.InverseTransformPoint(viewpoint[0].transform.position); | |||
cai.EyePosition = viewpoint[0].transform.position; |
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.
Consider adding a comment to clarify that the eye position is now intended to be treated as a world coordinate, aligning with the updated behavior.
Copilot uses AI. Check for mistakes.
Editor/Platform/GenericPlatform.cs
Outdated
@@ -156,7 +156,7 @@ private void InitEyePosition(GameObject avatarRoot, Vector3 eyePosition) | |||
viewpoint = viewpoints[0]; | |||
} | |||
|
|||
viewpoint.transform.position = avatarRoot.transform.InverseTransformPoint(eyePosition); | |||
viewpoint.transform.position = eyePosition; |
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.
Consider documenting that the eyePosition passed into InitEyePosition is expected to be in world coordinates, ensuring consistency with the change made in ExtractCommonAvatarInfo.
Copilot uses AI. Check for mistakes.
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 fixes an incorrect coordinate transformation in GenericPlatform that was affecting the positioning of viewpoints.
- Replaces InverseTransformPoint with TransformPoint to correctly calculate the viewpoint position.
- Updates the changelog to reference issue [fix: incorrect handling of viewpoints in GenericPlatform #642] regarding the incorrect handling of NDMFViewpoint in avatars with a scaled avatar root.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
Editor/Platform/GenericPlatform.cs | Corrects coordinate conversion for viewpoint positioning by using TransformPoint. |
CHANGELOG-PRERELEASE.md | Updates the changelog with a note referencing the bug fix for NDMFViewpoint. |
Comments suppressed due to low confidence (1)
Editor/Platform/GenericPlatform.cs:159
- The change from InverseTransformPoint to TransformPoint is intended to correct the coordinate conversion for eyePosition. Please ensure that eyePosition is provided in local space so that the use of TransformPoint yields the correct world space position.
viewpoint.transform.position = avatarRoot.transform.TransformPoint(eyePosition);
No description provided.