Search the Community
Showing results for tags 'flask'.
-
Hello, I'm pretty new to BabylonJs. I have created a few simple applications with it. What I want to do in this current project is be able to integrate babylonjs and flask microframework. I am much more familiar with python, flask and sqlalchemy etc. than I am similar javascript frameworks. I had set up some babylonjs code for visualizing a 3D model on a webpage using html, css, and javascipt only. I use ImportMesh to load the gltf (or glb) model into the scene. This works fine as I want. I have been problems migrating this to a flask app format. I tried three different ways and each time I have hit problems. I will describe each below. 1. Use ImportMesh just like I did for the 'plain' html, css and javascript: I tried to incorporate my existing html, css, and javasript files in a simple flask directory structure / simple app i.e. where my html, css, and javascript are in subdirectories to a main app.py file - exactly how I would set up any flask app. Every time I do that I get a notification saying that the model file (.gltf or .glb) can't be found and it throws a 404 error in the console. I've tried multiple different ways to define the path to the model file but it continues to throw this error. 2. Use babylon and model html tags instead: I then got rid of the javascript file altogether and I simply used the babylon and model html tags in my html to define the model rather than trying to import the model using ImportMesh. This works fine. The issue here is when i tried to control the css and add some actions to the css (or similar in javascript) like repositioning the container when I click a button it doesn't seem to work like the tutorial showed in the documentation. 3. I then tried to define my gltf as a text string. The thinking here was if I remove the reference to an external model file it could resolve my first issue. First I converted my 0.bin file to a base 64 encoded string and included it directly in my gltf file. I then took the entire gltf file as a text string into my javascript file and essentially called the model as a text string from there rather than as an external file. I checked the file worked in the babylonjs sandbox before I did this and it was fine but when I try to run my flask app it continues to throw an error saying it can't find the 0.bin file. The issue is here that this file is no longer needed (it was orphaned in my previous step as I have described when I converted it to base64). Overall, can someone help with what I need to do to get the ImportMesh function working in my original method. I'd much prefer to use the javascript ImportMesh way to do it as I feel (rightly or wrongly) I have much more control over the scene and control over the meshes etc. when I am coding in the javascript. Thanks.
-
Hey everyone, I spectate these forums all of the time so this a very late intro. I'm very excited to begin making games with Phaser but since I'm new to Web Development technologies (especially the backend) I'm certainly in need of some direction. I have a few beginner questions so please excuse my rudimentary knowledge of Web Dev. Aside from learning Phaser I'm picking up Flask to develop knowledge of the backend, that also means learning template rendering. I'm struggling with Hello Phaser, and I believe it has something to do with the distinction of loading Phaser assets and loading Flask assets. The problem is I'm not sure how to use Jinja to access the Phaser api (or rather 'game.load.Image' atm)? I also tried this setup with little luck. Any help here would be greatly appreciated! I've spent the last couple days reading tons about jinja, flask, phaser, html, and even found myself looking through the pixi api, but I just don't know enough about web dev or these apis in general to pinpoint exactly what I'm looking for at this point in time. Also, can someone point me in a good direction towards quality learning material for server side programming for gamedev. Advice on how to approach the topic would be very useful! I'm focusing on Flask at the moment, but soon after I'll try my hand at Django and other Web frameworks as soon as I develop a comfort zone and a project or two. Or there more convenient routes for learning the back-end that I can take? I accept that I have tons to learn but I'm so excited for Phaser that I'm willing to learn as much as it would take to do it right! (I have some experience with Python, Js, and Java. Also GameMaker, for what it's worth)