ChrisR

Members
  • Content Count

    50
  • Joined

  • Last visited

About ChrisR

  • Rank
    Advanced Member

Profile Information

  • Gender
    Male

Recent Profile Visitors

764 profile views
  1. To add on, i just noticed that if i register my main camera as the last active camera the hit test works! But now the camera viewport overlays my bottom left viewport, Which i don't want. http://www.babylonjs-playground.com/#1QXZAA#5 Move the camera so that the ground and sphere overlay the bottom left corner viewports to see what i mean. The hit test is working though.
  2. Hi guys, Trying to get action manager to work with multiple view ports. I am having an issue, that seems to be closely related to this question asked almost 2 years ago. (http://www.html5gamedevs.com/topic/5973-multiple-viewport-issues/) Take a look at my playground: http://www.babylonjs-playground.com/#1QXZAA#4 You will see what i am trying to do. Get the actionmanger to fire when mouse moves over the sphere. Code works well if you get rid of view ports. It doesn't work on its own (the hit test is far off in the distance) I have put an option2 in there, that works great. But it registers a camera to a pick test every frame. And this is my problem. Constantly running a registerBeforeRender pick test on an object every frame for what could be over 100 different objects in my application. This seems less than optimal. Or does actionmanager just basically run every frame as well so there is 0 difference in speed/resources? Regardless, I would still like to use actionmanager as its cleaner code, and on top of that it is simple to remove the actionmanager by just removing an object, rather than having to unregisterBeforeRender every object when it is removed. Thoughts? Thanks!
  3. I had this similar error a while back in serializing a scene. I had to modify the babylonjs code to put checks in to not serialize parts of materials that weren't there. However in the latest version of babylon this is fixed. Try using one of these babylonjs files to see if it fixes the problem https://github.com/BabylonJS/Babylon.js/tree/master/dist/preview release
  4. Like this? http://babylonjs-playground.com/#NJJPP#6
  5. Sorry thats JQuery, you asked for javascript... Try: window.onbeforeunload = function(e) { scene.dispose(); e = null; //setting e to null allows the refresh };
  6. Yea, this works for faking a border, doesn't really help with the background as it will just overlay any viewport.
  7. Try: $(window).bind('beforeunload', function(e){ scene.dispose(); e=null; }); //or $(window).bind('beforeunload', function(e){ scene.unregisterBeforeRender(<<FunctionName>>); e=null; });
  8. Use the Rotate function, it allows you to rotate around a space. Take a look: http://babylonjs-playground.com/#NJJPP#1
  9. I am curious if there is a better way to create a border around a viewport and a background around a viewport rather than creating additional viewports that have just border objects in it. I don't like this approach because i'm hiding objects in the far distance and cameras to render this stuff out. I have an example here using additional viewports to show what i am looking for. http://www.babylonjs-playground.com/#1QXZAA#2 Suggestions of how to achieve this without the additional cameras/viewports/objects? I would like just two cameras in a perfect world Thanks!
  10. Thanks Deltakosh, I was taking a screenshot every frame. I was extremely surprised at how well it worked though considering what it was doing. I'll get the lasted repo and give the viewport a try again. Thanks
  11. The problem could also be due to material mapping. Your best bet would be to use a debugger and see if there is a multi material applied to the mesh. If this is the case, then you might need to change the material in the multi-material submaterial array. http://doc.babylonjs.com/classes/2.2/MultiMaterial
  12. Ok, so continuing looking into this, i have tried to just take a screen shot of the camera every time and place it on a dom element. This works for me, but i am afraid of how resource hungry this could be. Take a look: http://www.babylonjs-playground.com/#1QFVQI Still looking for maybe a better suggestion, unless someone with knowledge on how the screen shot is captured will confirm that this works just fine without to much resource consumption creating a new screen shot everytime. (what happens with the last screen shot in this example when it is replaced? does it get garbage collected? continue to consume resources?) Thanks!
  13. Hi! I have been trying to get a second camera into my scene, so that this cameras view will overlay my main cameras view but just in the bottom left corner. Think if i wanted to create a mini-map, but to achieve this all i was doing was putting a camera way above the land looking down. Maybe best way to explain is please look at my example. http://www.babylonjs-playground.com/#1QXZAA#1 This is what i am trying to achieve. A second camera is looking at the same object but from a different angle. However, when you move the main camera with the mouse so that the objects in it are now positioned over the bottom left overlay, the objects go over top of my camera2 viewport since the objects are closer to camera1 then they are to camera2(z-buffering). How can i achieve this so that my bottom left overlay is always on top? is there a better way than view ports? like rendering the camera2's view to a texture that just overlays the canvas? Also, i had to create a third camera to force a white background on the viewport. Maybe there is a better way to do this? Thanks for any advice on how to proceed!
  14. Also, what could be a possibility, try checking mesh.getPivotMatrix(); if they all have different locations on the pivot matrix that will change its location. Since the complete matrices chain is: PivotMatrix x Scaling x Rotation x Translation Just a thought