Scene switching

Hello Everyone,

I am trying to make clickable meshes which will cause scenes to change when clicking on them, however I came across these two problems:

  1. Click issues: after switching scenes, the meshes from the previous scene are not visible, but the user can still click on them as if they are invisible. Occasionally the mouse pointer also doesn’t change when hovering over objects which are visible and clickable.

  2. The camera jumps after changing scenes. It is not a clean “cut” but some motion or momentum from the previous scene carries over to the next scene?

Is there any way to fix these problems? Or am I handling this incorrectly?

Here is the playground:

(WASD + mouse)

The objects seem to work correctly and are always clickable, but you may need to walk around and click at a different angle before the scene change triggers. Perhaps this is because the invisible shape from the previous scene interferes.

1 Like

Hey there, the problem is that both scenes add event listeners to handle picking, camera controls, etc. When switching scenes you can call detachConrol() on the old scene and call attachControl() on the new scene, that way only one scene is handling pointer, etc. events at a time. :slight_smile:

4 Likes

Thank you so much!

I don’t know if I’m going about this wrong… I was reading all the documentation and everything I could find but it was hard to arrive at an answer.

How do you all know this stuff? Trial and error? reading all the class properties and methods? (Feels like overkill, but maybe that’s what I have to do)

1 Like