As you can see if you activate the Virtual Tour view mode we created a svg minimap of the floor. What I’m trying to achieve is to swap out the svg with a real minimap of the current floor.
I’m using the same technique from here to create the minimap: https://www.babylonjs-playground.com/#1WROZH#124
What I’m struggling with:
The background of the minimap, I want it to be transparent on the minimap camera, but keep it on the main camera
Recreating the move to click on the new minimap
Recreating the current position and the view angle on the new minimap
for 1 and 2, I don’t know yet! I can try things and I’ll you know if I find something.
Basically, for 1, maybe create a mesh with transparency or create a new scene.
for 3 I have more ideas: Get the camera view direction, set the Y component to 0 and normalize it. You will have the direction on X/Z axis. With a Math.atan2(z, x), you will get the angle. Append a quad with the rotation ontop of the minimap and that should be it. I can try to do a PG.
The only downside I have now its that I have a scene with quite some elements and the second camera doubles the rendering of all the elements on each frame. @Cedric it’s something that I can do to render the minimap camera only when needed? Or is there anything else I can do to optimise this?
You can try to do a rendering of the minimap in a texture and only update that texture when needed. If you don’t have dynamic objects, then you don’t have to re-render.
You can refresh your minimap as you want. If the minimap scrolls but the content is static, maybe you can just change the UV or translate the minimap plane.
If I render it to a texture, I will lose the ability to use ray-casting and move the camera to the targeted point. Is there a way to keep this functionality or an alternative way to achieve this ?