Skip to content

scene from useThree is not always a THREE.Scene within portal #2725

@mattrossman

Description

@mattrossman

Sandbox: https://codesandbox.io/s/issue-createportal-and-state-scene-pvtlsz?file=/src/App.jsx

Output:
console logs showing 'outside portal' yielding a Scene object, followed by 'inside portal' yielding a Group object

According to the docs and type definitions, scene returned from useThree should be a THREE.Scene representing the scene. However, when this value is read within a component that has been dynamically parented to another object with createPortal, the scene value contains the parent object which could be a different type such as THREE.Group.

I would expect scene to always contain a scene so that components can modify scene-specific properties such as .background. I would only expect the scene value to change if the createPortal target was a different THREE.Scene.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions