Here’s my scene: Babylon.js Playground
I’m trying to make this YouTube link attached to the wall (or at least in a fixed position on the scene to make it appear that way) instead of the camera, in whatever the simplest way is.
I pulled the YouTube texture from here: https://playground.babylonjs.com/#AGY66J#6 and built everything else myself.
I imagine this is fairly easy but I’m a total noob at this so any input is appreciated!
Bumping this in case anyone didn’t see it!
I believe that the reason it’s staying fixed is that it’s always using the camera’s position as the starting point for where to draw the video:
function createPage(scene, camera, url = "6y4BMVhkQPs")
{
scene.registerBeforeRender(function() {
let cp = camera.position; <-- Right here
let dx = Math.atan(Math.sqrt(cp.x * cp.x + cp.z * cp.z) / cp.y) * 180 / Math.PI;
let dy = 0;
...
Try taking a look at this example that I found with the Playground Search tool: teatro_2 | Babylon.js Playground (babylonjs.com) [Changed the video used because the original one wasn’t found.] This example may not be perfect but hopefully, it can give you a bit of inspiration.
This is EXTREMELY helpful, @PolygonalSun - thank you so much. I’m going to make some adjustments around this and will get back to you. Thanks again!
Hi @PolygonalSun - thanks again for your recommendation. I’ve built up the scene as I was hoping to do for the most part but can’t figure out how to adjust the position of the iframe/YouTube player. I’m assuming it has something to do with either:
Or:
But can’t figure out exactly which. I’m trying to lower the video on the Y axis and “pin” it to the middle block. I don’t necessarily need to actually pin it- if it’s easier I’d like to just adjust the position of the video to make it appear that way.
Any advice would be greatly appreciated - or if anyone else is reading this I’m open to any suggestions. Thank you!