• Content Count

  • Joined

  • Last visited

Everything posted by Wemperer2

  1. Sorry to bother once again but I have to come back to my original question. How do I check the rotation of an object? The rotationquartions isn't working for me, I just do not understand the math (im not a math person). I need things in radiant/degrees. When I use: player.rotate(BABYLON.Axis.Y, BABYLON.Tools.ToRadians(1), BABYLON.Space.WORLD) I need to figure out what property of the mesh this is rotating so I can convert it to Radians. If I attempt to convert rotation.Quartions I get NaN. player.rotation always returns 0, 0, 0. I I swear when I figure this out I'm writing some Idiots Guide level tutorials...
  2. Is there a way to use the filtergroups with imposters? I have the physics working and collision is detected using imposters and it seems using CANNON body objects is a bit more complex. (creating a world, adding objects to world etc) My rotation problem is solved. Thanks for the help I really appreciate it.
  3. I'm making a space game and I'm wondering what would be a good way to simulate distant stars. My initial thought was to randomly generate white specks super far out but that doesn't seem very respectful of resources. Is there a way to simulate it with clearColor or perhaps a repeated PNG?
  4. Thanks for the reply I am using the imposter system. I can't figure out how to attach a Body to a babylon mesh....
  5. Ok. Couldn't figure out how to delete this post so anyone who happens to fall upon it in the future... You're using the wrong type of camera. Use the arcRotate camera, position it, and set the target to your character. var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 100, character, scene); The cam will stay locked on, you just need to get the rotation right.
  6. I have an issue where I am using the followCamera in a top down view (think original grand theft auto). It works fine except when I apply impulse to my character/mesh/imposter to where the character moves backwards, the camera rotates a full 180 degrees. I want the camera to stay in the position so that it never rotates. Meaning, the north portion of the map will always be north, regardless of the direction of the character/mesh/imposter the camera is following in the top down view.
  7. I'm trying to figure out how to make a projectile pass THROUGH certain objects while making contact with others. I'm also having the issue where my projectile is created dynamically so I can't stick in a event listener in the registerBeforeRender() function because they don't exist at the time that function is called. Basically, I want to be able to shoot enemies in my game, while not shooting allies. I'm also having an issue where I can't seem to get rotation coordinates of my object. I can get the coordinates but when I check mesh.rotation() I always see 0, 0, 0 even when I change it with a event listener...
  8. I intend to import some models and animations I created in Blender but I have no idea how games incorporate animations. Since I plan on making a mobile game, I'm concerned complex models on top of intricate animations will ruin my project. I understand how 3D video animation works in regards to rendering the animation (taking hundreds of thousands of pictures) but how does this work in games? Does everything that moves pre-rendered and just played upon certain triggers or does the cpu/gpu calculate/manipulate meshes on certain triggers? Sorry if this doesn't make sense but I have the feeling I'm going to end up with a bunch of animation files for each model, for each type of movement and depending on how large these files are, may render a mobile game I want to make impossible.
  9. @gryff Holy cow man you went way above and beyond there! I really appreciate it. I'll be playing with this for awhile. I'm new to blender so that's why there is alot of stuff missing with the Guy. I just waned to practice creating a model and getting it into Babylon. What exactly does this mean? The components of the mesh should be all in the same layer? What are origins/transformations?
  10. I'm so sorry, late night. characterv2_17_7.blend
  11. Thanks to you both. The code looks WAY cleaner and works as far as loading the stage but my Guy still doesn't get imported. It's back to the loading loop and it is def with the import of the guy line. Is it because he has an armature? I couldn't find (I don't think its actually there) the 'export selected only' option in blender but I am kinda guessing the import is failing because 'guy' is an entire scene and I'm back to my multiple cameras issue. Am I blind or is that checkbox missing or am I exporting wrong? Here is Guy: [snip]
  12. Thank you, that was indeed the problem. Now I'm having an issue importing meshes. It seems to 'work' but I don't see the supposedly imported meshes. if (BABYLON.Engine.isSupported()) { var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); engine.enableOfflineSupport = false; BABYLON.SceneLoader.Load("", "stage.babylon", engine, function (newScene) { newScene.executeWhenReady(function () { var camera = new BABYLON.ArcRotateCamera("ArcRotateCamera", 0, 0, 0, BABYLON.Vector3.Zero(), newScene); var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), newScene); camera.setPosition(new BABYLON.Vector3(-10, 50, -50)); camera.attachControl(canvas, false); light.intensity = 1.2; engine.runRenderLoop(function() { newScene.render(); }); BABYLON.SceneLoader.ImportMesh("guy", "", "guy.babylon", newScene, function (newMeshes, particleSystems) { }); }); }, function (progress) { // To do: give progress feedback to user }); }
  13. Hello. I'm having trouble importing a scene from blender. The screen is and enless loading loop and I'm getting this error in console: Uncaught TypeError: e.UniversalCamera is not a constructor if (BABYLON.Engine.isSupported()) { var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); engine.enableOfflineSupport = false; BABYLON.SceneLoader.Load("", "guy.babylon", engine, function (newScene) { var camera = new BABYLON.ArcRotateCamera("ArcRotateCamera", 0, 0, 0, BABYLON.Vector3.Zero(), scene); var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene); scene.clearColor = new BABYLON.Color3(0, 1, 0); camera.setPosition(new BABYLON.Vector3(-10, 50, -50)); camera.attachControl(canvas, false); light.intensity = .5; // Wait for textures and shaders to be ready newScene.executeWhenReady(function () { // Attach camera to canvas inputs newScene.activeCamera.attachControl(canvas); // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function() { newScene.render(); }); }); }, function (progress) { // To do: give progress feedback to user }); }
  14. There is a strange bug I'm experiencing where I set a foreground layer var foreground = new BABYLON.Layer("back0", "images/parchmentMap.jpg", scene, false, new BABYLON.Color4(1, 0, 0, 1)); then when I delete it with dispose(), all my sprites turn to the image used in the layer (but without the color). While i'm here, How would I go about getting my sprites to appear on top of this foreground layer? I would use a background but I want to cover everything on the screen temporarily and display the sprites on top of the foreground image without deleting the scene.
  15. Why is it that if I create an array and put an object in it, then check the array's length, I get incriments of 15 for each object in the array instead of 1 per object? This is screwing me up because I'm not sure how to reference what I put in the array because I don't know where it is. var me = { name: 'bill',}var arr = [];arr += me; // one objectalert(arr.length); //15 objects in arrayalert(arr[0].name) //undefined
  16. Now I have a new problem. I need to reference an object created by a method in a 'class' var methods = { createBlock: function(size, x, y, z, dir){ var objRef = BABYLON.Mesh.CreateBox("box", size, scene); objRef.position = new BABYLON.Vector3(x,y,z); objRef.rotation.y = Math.PI/dir; objRef.material = mats.cellWall(); }} When I try to stick it into this trigger for the action it isn't detected var trigger = {trigger:BABYLON.ActionManager.OnIntersectionEnterTrigger, parameter: objRef}; I've also tried: var trigger = {trigger:BABYLON.ActionManager.OnIntersectionEnterTrigger, parameter: methods.objRef};
  17. Hello first post here. I just started coding with babylon 3 days ago and not being a pro with javascript I'm having trouble trying to wrap my head around the action manager. Specifically what I want to do is trigger a predefined function once a mesh is detected inside another mesh. I have a block that progresses across the screen and once it intersects with another block, I want it to simply throw an alert but I have no clue how to construct the action manager for the intersection and launching the function, tho i got the moving part down. [edit] I figured it out. For anyone else who might stumble across this thread and need it var trigger = {trigger:BABYLON.ActionManager.OnIntersectionEnterTrigger, parameter: OBJECT-BEING-ENTERED};var crash = new BABYLON.ExecuteCodeAction(trigger, function() { alert('CRASH!!!!!! BURRRRRRRR EXPLODIE NOISES'); }); OBJECT-DOING-THE-CRASHING.actionManager.registerAction(crash);