cefleet Posted December 8, 2015 Share Posted December 8, 2015 Greetings all,I have a small issue with importing a mesh and setting the position. My scenario is this:I have "detectors" (invisible mesh boxes) in my scene. When the player mesh collides with these detectors something happens. The player mesh is imported after the scene is loaded so the detectors are already activated. Well I have one that is sitting around the position {x:0, y:0, z:0}. So as soon as the player is loaded it fires the detector action (because the players' location is 0,0,0 from blender). Even if I set the position right as it is imported. Now I know of a workaround of just editing the players location in the .babylon file. But I was wondering if there was another way to bring the mesh into the new position without starting at the origin. Any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted December 8, 2015 Share Posted December 8, 2015 You can also set the position in Blender. Pressing 'n' bring up stuff to the right of 3D window. forgot the window name. You could change the location of you player there. It is better than changing the .babylon by hand. Quote Link to comment Share on other sites More sharing options...
cefleet Posted December 8, 2015 Author Share Posted December 8, 2015 Yeah, I thought of that. The problem there is that I have teenagers making the models for the game(s), and for various reasons I tell them to make the origin of all there models 0, 0, 0. Changing by hand in the .babylon isn't a really a problem. I can just add it to a tasks in grunt. I was just wondering if there was a "pre-render" way of doing it. Thanks for the insight though. Quote Link to comment Share on other sites More sharing options...
RaananW Posted December 8, 2015 Share Posted December 8, 2015 Hi,Did you try changing the mesh position right after loading? It should actually be enough to move them when they are loaded in the scene load / mesh import callback. Just wondering if it works... Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted December 8, 2015 Share Posted December 8, 2015 Can you condition your triggering your mesh also being isEnabled()? I myself plan on making .blend per character. It is good practice to define them at 0,0. I do not want everything showing up there briefly in the wrong place. I am going to add a 'Load Disabled' check box in the Mesh custom exporter properties of Blender. When checked, you can do anything you want, and this or its children are not going to show. You can then place it where it is supposed to be in the scene & setEnabled(true); Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted December 8, 2015 Share Posted December 8, 2015 Done, well at least on my version. Turns out enabled was already being written in .babylon file. It was just that it was hard coded to True. It is also being written into .babylon visible. This is triggered by the property 'hide_render'. I cannot find this in the interface. If you can either not wait for my next release, or you do not want to hide the meshes children, all you have to do is find in the User Interface where this is checked. If you can condition your triggering, then never mind. Quote Link to comment Share on other sites More sharing options...
cefleet Posted December 8, 2015 Author Share Posted December 8, 2015 @RaananW Yeah. I have been doing that but like I said the triggers are already activated before the player is ever loaded so even instantly it fires off the trigger. My workaround works fine. I just don't want to do a workaround if there is a "correct" way of doing it. @JCPalmer Sound good. I actually wanted to chat with you about stealing using some of your code for exporter with what I am working on. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted December 8, 2015 Share Posted December 8, 2015 Ah, found the hide_render button. It is the little camera icon at the right end of the line in the outliner for the mesh. Have to document that in my next Tower of Babel documentation update. As far as code forking, everything is Apache 2.0. You might want to wait till my next version comes out (soon). Also there are really 2 exporters, based off the same code base. The Tower of Babel system writes Typescript / Javascript instead. It also does shape keys. TOB is actually the system I develop with. I use Netbean's ability to diff / edit 2 arbitrary files. I end up "clicking" most of the changes from TOB to the official exporter. Quote Link to comment Share on other sites More sharing options...
cefleet Posted December 8, 2015 Author Share Posted December 8, 2015 Well, I'm not aiming to making a new exporter, thus the reason for using your code base. I teach kids to make video games and I use my game engine (A3D) built around babylonjs and blender as the tools. My end goal is to allow students (or anybody that wants to use A3D) to be able to launch a basic game from blender. I am just not really familiar with blender's python UI api. I need some examples to look at and modify.Currently I just have a lightly custom version of the official exporter. Right now it has some basic "types" for meshes like Obstacle, Actor, Enemy, Spawn, Trigger etc., and each item type has an option that is a json object. also when you export you are given options for the type of module to export to (scroller, platformer, adventure).Then just just launch the game with node.js http-server. Eventually I want to have it where you can have external mesh loaders, pre-built materials (from the material libraries), and where there is a "build and launch" button from the blender UI. I just need to get a better grasp of howto make a blender plugin... Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted December 8, 2015 Share Posted December 8, 2015 Actually, I do not Python, or didn't when I started refactoring it. I have enough experience & am stubborn enough to get away with a lot of stuff these days. Did not know Javascript or Typescript either. Just start, which you did. There are sites which describe python. Just do a search starting with Blender. I must have done 1000. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.