brianzinn

Members
  • Content Count

    833
  • Joined

  • Last visited

  • Days Won

    7

Reputation Activity

  1. Like
    brianzinn got a reaction from webdva in Recommended way to get time between last frames in Observables? (i.e. deltaTime)   
    Welcome to the forum!.  deltaTime is available on the engine:
    http://doc.babylonjs.com/api/classes/babylon.engine#getdeltatime
    http://doc.babylonjs.com/api/classes/babylon.scene#getengine
    scene.getEngine().getDeltaTime() I've never needed to go to this level for animations.  Can you share your animation code as a playground?  I have multiple smooth animations running simultaneously without any low level coding, but not sure what you are animating.
  2. Like
    brianzinn reacted to JackFalcon in BABYLON.Augmented Reality ...   
    looking into this...
    babylonjs is no longer at this location on Ar.js:
    https://github.com/jeromeetienne/AR.js/tree/dev/babylon.js
    @jeromeetienne, friend, any info on AR.js + Babylon status?
    Also @brianzinn is right - original solution cross-matrix calculations (because I don't understand matrix inversions..), but then jerome etienne figured out how to make them babylon specific (details above).
    Old, but still have a backup if needed...
  3. Like
    brianzinn got a reaction from JackFalcon in BABYLON.Augmented Reality ...   
    From @mkaouri "If the iOS 11 showing the front camera, you've to make sure that faceMode constraint in artoolkit.min.js is set to 'environment' to use the back camera of your mobile."
  4. Like
    brianzinn got a reaction from JackFalcon in BABYLON.Augmented Reality ...   
    hi @MarianG, I didn't really follow the AR.js - from my recollection it was relying on another engine renderer.  If you are not specifically after AR.js, do the jsartookit examples no longer work https://github.com/mkaouri/jsartoolkit5?
    Also, BabylonJS 4.0 has AR via WebXR, if that meets your needs (it's very early market for browser support).  I haven't been following close enough, but otherwise if you want a demo of that (like magic window) check here: https://github.com/BabylonJS/Babylon.js/issues/3899
  5. Like
    brianzinn got a reaction from iri in Path all points animation   
    You can also add onAnimationEnd param:
    scene.beginAnimation(vehicle, 0, length, false, 10, () => { heartFlight(vehicle, move_trajectory, index + 1); }); https://www.babylonjs-playground.com/#X0MDYG#2
    If you added any points during the animation, they would get added to the end.  You would need code to restart a completed animation or perhaps a queue push/pop as @bghgary suggests.
    I added some smoothing, so the speed is consistent on different length path segments.  If you don't want a steady speed then you can look at slerp on total length or rebuilding animation when points are added (start at current pos) and using the built-in easing functions.  cheers.
  6. Thanks
    brianzinn got a reaction from bghgary in Path all points animation   
    You can also add onAnimationEnd param:
    scene.beginAnimation(vehicle, 0, length, false, 10, () => { heartFlight(vehicle, move_trajectory, index + 1); }); https://www.babylonjs-playground.com/#X0MDYG#2
    If you added any points during the animation, they would get added to the end.  You would need code to restart a completed animation or perhaps a queue push/pop as @bghgary suggests.
    I added some smoothing, so the speed is consistent on different length path segments.  If you don't want a steady speed then you can look at slerp on total length or rebuilding animation when points are added (start at current pos) and using the built-in easing functions.  cheers.
  7. Like
    brianzinn reacted to tortru in mesh.getAbsolutePosition() always 0,0,0   
    Yep. You are right. That really makes sense. Thank you.
     
  8. Like
    brianzinn reacted to timetocode in Degrading sound   
    Now that I have this reproduced, I think I'm realizing that this idea was never going to work due to the number of sounds. I did a little bit more testing with a 500 KB wav file vs a 15 KB mp3, and the degradation seems more related to the number of sounds than their size.
    In my game each weapon has like 5-20 sounds, and a player can hold a few weapons. The walk/run cycle has like 16 sounds per material (concrete, wood, grass, etc). It can add up to about ~100 possible sounds per player, though 99% of them aren't playing at any given point. BJS seems totally fine with that many sounds, but it looks like attachToMesh is not designed for this. I read the source code, and it looks like it *might* be viable if it would check if the sound is playing before rebuilding the matrices. Currently it does some fairly expensive work, even for non-playing sounds (setPosition and computeWorldMatrix fill the profiler when stress tested with cloned sounds on moving meshes).
    I'm going to test positioning the sounds manually at the time that they are played, and not having them move along with the mesh. If that doesn't work I guess I'll pool them in addition.
     
    Edit: definitely need a pool
    Edit#2
    at 21 players firing the same automatic rifle, the pool brought the active number of sound instances from 210 down to 59
    Here's an ultra simple auto-expanding pool if anyone wants. Usage is just to use 'get' for short-lived sounds and it will handle allocation and releasing on its own. It never deallocs.
    class SoundPool { constructor() { this.scene = null this.sounds = {} } init(scene) { this.scene = scene } allocate(name) { const sound = BABYLON.Sound.FromAtlas(name, name, this.scene) sound.onEndedObservable.add(() => { this.release(sound) }) this.sounds[name].push(sound) } get(name) { if (!this.sounds[name]) { this.sounds[name] = [] } if (this.sounds[name].length === 0) { this.allocate(name) } return this.sounds[name].pop() } release(obj) { this.sounds[obj.name].push(obj) } } const singleton = new SoundPool() module.exports = singleton BABYLON.Sound.FromAtlas is a little wrapper that clones sounds without making additional xhrs (e.g. 'sounds/foo.mp3', clones it and applies new options)
  9. Like
    brianzinn got a reaction from timetocode in Degrading sound   
    It's not because the camera is further from the player when you have more players?  When you attach a sound to the mesh (ie: sound.attachToMesh(mesh)) then the sound comes from the location/distance of the mesh.  I load quite a few sounds in my game attached to many meshes and have not found any issues.  Any way you can reproduce as a PG otherwise?
  10. Like
    brianzinn got a reaction from Sebavan in Load gltf from data file error   
    try like this
    https://www.babylonjs-playground.com/#1AbIIF#10
  11. Like
    brianzinn reacted to MarianG in BABYLON.Augmented Reality ...   
    Thanks @brianzinn.
    Actualy I checked webXR support from babylonjs, and I faced some issues, or I didn't understand very well how it work,...maybe I'll open a different topic for this. And I think I'll focus on this once webXR will be by default enabled on browser.
     I tried jsartoolkit5, and I'm faceing some problems with this too 😋 in one device is opening front camera, in other is opening back, and sometimes I lost camera for some reasons, I have to deep learn about this.
     ... and I have remembered about this topic and I wanted to check some links from here but most of them are NotFound. I hoped it'll be faster to do a simple example😀
  12. Thanks
    brianzinn got a reaction from waverider in Load gltf from data file error   
    try like this
    https://www.babylonjs-playground.com/#1AbIIF#10
  13. Like
    brianzinn reacted to JohnK in Question about isVisible   
    Sorry don't know the reason why. Just following @Deltakosh's advice http://www.html5gamedevs.com/search/?&q=setenabled&type=forums_topic&author=Deltakosh&nodes=28&search_and_or=or&sortby=relevancy
  14. Like
    brianzinn reacted to thrice in Question about isVisible   
    The reason (or at least one of) is because isVisible=false can be used to group meshes together, so that the children meshes are still active in the scene (like a transform node in newer babylon versions). If you setEnabled(false) instead the child meshes will be removed from the rendering loop also. I believe there are other uses I've encountered as well just can't think of off the top.
  15. Like
    brianzinn reacted to Dad72 in Question about isVisible   
    The difference is that the hide object with isVisible can still be clickable or receive collisions.
    Think of an invisible wall that gets the collisions. While with setEnabled, the object is not visible and not rendered.
  16. Like
    brianzinn got a reaction from Sebavan in Crane Game   
    This is what you are after:
    mesh2.setParent(null); That will unparent the mesh, while maintaining rotation and position in world co-ordinates (instead of local to the parent).  If it doesn't work just post a PG.  I've got lots of similar versions of it in my game   If you have physics on your crane cargo this is where you would call .wakeUp(), too (ie: get crane cargo to fall). Cheers.
  17. Like
    brianzinn got a reaction from Wingnut in Crane Game   
    This is what you are after:
    mesh2.setParent(null); That will unparent the mesh, while maintaining rotation and position in world co-ordinates (instead of local to the parent).  If it doesn't work just post a PG.  I've got lots of similar versions of it in my game   If you have physics on your crane cargo this is where you would call .wakeUp(), too (ie: get crane cargo to fall). Cheers.
  18. Like
    brianzinn reacted to Sebavan in Solid Particle System UVs: particle[p].setVerticesData( )   
    The three common ways would be :
    - inheritance so that you can modify the base call functions
    - creating a proxy which encapsulates the sps and drives the rest of your code
    or in Typescript, you can extend any classes with class Augmentation: Look at Module augmentation: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
     
  19. Like
    brianzinn got a reaction from JohnyCage in Import lights from 3ds max   
    I don't know if the 3DS export instead to glTF will help (yet - maybe it's too early).  I have not looked into that exporter, but did read an interesting article Adobe posted 2 weeks ago that may be of interest to you.  Check out the section on lighting (KHR_lights_punctual, EXT_lights_image_based ) :
    https://theblog.adobe.com/behind-the-scenes-with-adobe-dimension-engineers-how-we-built-the-3d-publish-feature/
  20. Thanks
    brianzinn got a reaction from Sebavan in GCanvas alibaba   
    @Sebavan looks like a custom C++ implementation of OpenGL ES 2.0.  For Android they use a JSBridge (based on Cordova) - iOS bridge is based on WebViewJavascriptBridge.  I looked into their project a bit  - no commits since April and issues are not getting replies.  Going to give it a miss for now, but will be checking in to see if they progress, since it's a great idea - maintaining their own engine I think is a lot of effort even to get to ES 3.0.  It ties is so nicely with Weex - I hope they invest in this project further
  21. Like
    brianzinn got a reaction from Wingnut in GCanvas alibaba   
    Has anybody written anything for GCanvas with BabylonJS on a mobile device?  Looks promising...
    https://alibaba.github.io/GCanvas/
    "At this moment, we have already supported 90% of 2D APIs and 99% of WebGL APIs."
    If nobody has tried it out - I'll post back here when I get a chance to, which will take a while...  Cheers.
  22. Like
    brianzinn reacted to ozRocker in [SOLVED] polygroups?   
    I finally got off my lazy ass and implemented a solution.
    You can see the result here: preview.punkoffice.com/bodyparts
    I altered the mesh.py file of the Blender exporter to parse the vertex groups.  If anyone wants to see the code changes I've attached my version of mesh.py.  The bits I added have # _NEW_ before the code.  I'm not great at Python so maybe it can be improved.  @JCPalmer this might be of use to you if you want to incorporate vertex groups.
    So the extra JSON in the .babylon file looks like this: 
    "vertexGroups":[{"name":"waist","id":"waist","indices":[4053,4054,4055,405, etc....]}] In the Babylon.js code in the Mesh.parse function I added this ( @Deltakosh if you want to incorporate vertex groups you can use this)
    // Vertex groups if (parsedMesh.vertexGroups) { mesh.vertexGroups = parsedMesh.vertexGroups; } I also had to add a new function to find the vertex group:
    BABYLON.Mesh.prototype.getVertexGroupByName = function(vgName) { for (var i=0; i<this.vertexGroups.length; i++) { if (this.vertexGroups[i].name == vgName) return this.vertexGroups[i]; } return null; }  
    I'm not sure if this is the best way so feel free to ignore if its not efficient, but it works for my needs.
    mesh.py
  23. Like
    brianzinn reacted to thrice in Introducing Dark Matter CCG   
    Hey all,
    So I'm finally starting to promote my babylon based project a bit now, that I have an actual site together at www.darkmatter.game - The game itself isn't hosted there or anything (it will be a PC+Mac release), but I have been putting out a ton of playtest / demo sessions I've recorded on YT and posting on site (and will be throughout the next week). So anyways, if you're into digital CCGs or CCGs in general, you should def check it out as it's quite unique. I would also love any feedback, and am happy to answer any questions you might have!
    Also, should say thank you to anyone on these forums who has helped me in any way up to this point! I mean, these forums are seriously great, and filled with helpful people. (Should my project make it into the big leagues you can be sure I'll do a forum search and you can expect your name in the credits  )
  24. Thanks
    brianzinn got a reaction from servusdei in issue with camera.isInFrustum()   
    try this: 
    parent.computeWorldMatrix(); https://www.babylonjs-playground.com/#ZJYNY#96
    logs. true, false. check the frustum computation
  25. Like
    brianzinn got a reaction from Buzul in Basic example not working in my server/with my assets   
    You need to setup CORS on your images, if you want them to work in the playground (ie: put them on github).  The good news is that it will work on the same server without CORS.
    Don't be sorry for being a newbie - we all started somewhere.  Much better to be a newbie and learn new things