Skip to content

fix(client): correctly handle coordinate SceneUI attachment#1

Closed
AnrokX wants to merge 1 commit intomainfrom
fix/sceneui-coordinate-hook-client
Closed

fix(client): correctly handle coordinate SceneUI attachment#1
AnrokX wants to merge 1 commit intomainfrom
fix/sceneui-coordinate-hook-client

Conversation

@AnrokX
Copy link
Copy Markdown
Owner

@AnrokX AnrokX commented Mar 2, 2026

Summary

  • Mark coordinate-based SceneUI instances for an initial position sync when they are created on the client.
  • Clear any prior entity attachment when SceneUI.setPosition(...) is used, keeping attachment modes mutually exclusive.

Why This Is The Right Fix

  • SceneUI can be attached to either an entity or a world position, not both.
  • Without clearing attachedToEntityId on setPosition, update logic can continue following entity-path behavior.
  • Without initial _needsUpdatePosition for coordinate-spawned SceneUI, the first world transform can be missed.

Testing

  • Local manual validation on March 2, 2026:
    • Ran local server and local client, connected at http://localhost:5173/?join=local.hytopiahosting.com:8080&debug.
    • Verified SceneUI rendered and stayed hooked to the configured world coordinate.
  • Temporary local-only test/workaround edits used during validation were reverted.
  • This PR contains only client/src/ui/SceneUI.ts.

@AnrokX AnrokX marked this pull request as ready for review March 2, 2026 19:43
@AnrokX
Copy link
Copy Markdown
Owner Author

AnrokX commented Mar 3, 2026

Edge case: while SceneUI is pending template registration, merge logic drops undefined fields. That can lose the detach signal (attachedToEntityId = undefined) when switching to position, so it may still instantiate in entity-attached mode.

Minimal fix: in pending merge, treat position and attachedToEntityId as mutually exclusive and clear the opposite field when one is set.

@AnrokX
Copy link
Copy Markdown
Owner Author

AnrokX commented Mar 3, 2026

Closing as superseded by upstream PR: hytopiagg#8

@AnrokX AnrokX closed this Mar 3, 2026
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.

1 participant