Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by Snouto

  1. Ding ding ding ding we have a winner! That fixed the problem immediately. That's both super satisfying and incredible perplexing and frustrating at the same time. Just when you think you're getting a handle on BJS something like this occupies half your day! Well I appreciate your help there @brianzinn you managed to solve two big issues for me and now the animation works as planned. Cheers!
  2. Thanks dude, that easing code is exactly what I was looking for. And now that I've seen it I realise I've used it before in one of my other hundred test scripts 🙄 Following on from my test code I've been searching around more and found an article on pivot points. My code now looks like this: var onMeshPicked = function(bjsEvent) { myPickedMesh = bjsEvent.source; if(!myPickedMesh.isPickable) return; var frames = 90; // number of points if( parent===null ){ parent = myPickedMesh.parent; var CoR_At = new BABYLON.Vector3(0, parent.position.y, 0); var axis = BABYLON.Vect
  3. Alright errybody This is a question more about maths than anything else, and i'm terrible at maths so I'm hoping someone (maybe @Wingnut) can help me here. My scene is loaded from a blender export, which in itself is partially an imported FBX from C4D (still waiting on that C4D exporter boys!). I have a mesh within the scene that has a set position, and I want to allow it to orbit in a circle when clicked or tapped by the user. Fundamentally this is fine and I have most of the logic in place, but I'm struggling to figure out how to make it animate from it's initial position. All
  4. Thanks for the information chaps, very helpful 👍🏻
  5. Sigh....I hate myself sometimes. Tried a bunch of angles except god-damn 0. Okay so that works on a couple of the meshes in my scene that need it. Here's the thing though, whereas before it was super convenient to be able to apply the flat mesh across the whole scene it seems now I have to choose individual meshes and set the EdgeSplit manually. If i was only doing this one time that would probably be fine but in my case I am receiving regular updates to the FBX model I'm importing and so every time I import a new FBX I'm going to have to manually go through every mesh and set the EdgeSplit ag
  6. Yo 3D dudes and dudettes I've just updated the Blender exporter and BJS to the latest versions as I was using some fairly old code. One of the first things I noticed was that my .babylon file has gone from 2.1mb down to 600kb, which is awesome, so bravo to you guys for that excellent piece of optimisation. I also noticed through first observing and then from looking about the internets that the export option to make everything Flat has vanished. I confirmed this from a post by @JCPalmer here For my project I still wish to maintain that flat look, so I understand one way to do
  7. Okay, never mind, regarding the previous post it was being caused by the animation export options not being checked. I found this post by @JCPalmer which led me to try checking those new animation options, and wouldn't you just know it it worked instantly after that. JCP - you're alright with me. Good lad. 👍 So for the time being, at least I know I can do the C4D -> BJS route with animations kept intact. Yet even when setting the camera export options as I've just described in my original Helicopter scene, it still doesn't work properly. I must be doing something wrong in Blend
  8. Okay so this is slightly off the original topic, but here's a very simple animation test. It was created in C4D, exported to FBX, imported in to Blender, then exported to BJS. In blender the animation appeared fine, but once in BJS it went sideways. Here's the video of the scene in blender - you can see visually how the animation should behave. It's just two objects, each with a baked animation. blender.mov Here's a PG using the exported BJS file. Notice how it just aint right, yo. https://www.babylonjs-playground.com/#02YH29 It appears as though the keyframe
  9. Thanks for the replies chaps, I'll have a look at your suggestions and come back with any further questions. @JCPalmer thanks for the tip, seems a bit... steampunk.... but I'll defo take a look at that
  10. Yo party dudes Here I am, still at this damn project, still struggling with everyday issues (yo). Latest in a long list of probably-easy-but-hard-for-me questions is regarding animation. To set the scene (arf!), lets assume I have a Blender file with an empty parent object. Inside are two child objects; helicopter_body, and helicopter_props. What I'd like to do is, in Blender, animate the _props object so it looks like the chopper blades are spinning. Then in BJS animate the parent and children. Okay so once I have a simple prop rotation animation set in the dope sheet, if I exp
  11. No worries @davrous I'll work with what I've got and if the "powers that be" (i.e. the client) decide the effect needs work I'll come back to you with a PG. Cheers!
  12. Thanks for the information @davrous - my reasons for needing such behaviour are quite specific to my project and probably not likely to be needed elsewhere, but to answer your question I wanted to have a visual representation in my scene of audio playing at a particular location. To do this I'm simply updating the Y scale of a mesh in time to one of the frequency channels, but since the analyser only works when the audio can be heard this means that from afar my mesh does nothing and the effect is lost. It's not vitally important though. I'm still interested in understanding what updates
  13. Any chance of a follow up on this stuff @davrous? Cheers
  14. Someone can probably confirm this but as I understand it, you can check the imported mesh's animations array property. If it's null or length==0, you don't have an animation. Something like: if( MESH_NAME.animations && MESH_NAME.animations.length > 0 ) // you've got an animation
  15. On a seperate note but still related to spatial audio, i've just noticed that using the audio analyser with spatial audio only works if the audio can be heard. So for example if the spatial audio is at a distance that means audio can not be heard, then the soundtrack to which the sound is attached will not create any data for the analyser to use. Is there something going on under the hood with spatial audio whereby maybe audio.pause is being called when out of range, to save on resources perhaps?
  16. Indeed you are correct that does work well, but if you recall the original purpose of this thread was to discuss spatial audio in the context of an arc camera attached to a mesh and the mesh then animated. You seemed to acknowledge that using spatial audio in this way would require changes to the arc camera and added it to your 3.3 milestone. I then made a change in the code at my side, but I'm not sure whether this is the change you have added to your 3.3 milestone or if you intended to do something more, and that's really what I'm following up here. With regards to my observations of my
  17. Is there any way I can get the arc camera spatial audio update added sooner rather than later? Just noticed the 3.3 timeline is up until september 2018, which is well beyond my needs. @Deltakosh when you said earlier that support for the arc rotate camera was needed, what exactly is it missing at the moment? Like I mentioned in a subsequent comment I can hear the audio kicking in while using my arc camera. I have reservations about whether the audio is playing correctly, in the sense that it starts when it should and increases in volume as it approaches the source, and that the ran
  18. So by your example, max distance would equal the radius of the spheres in your scene I.e. half the sphere diameter? If I had a cube of height,width,depth = 5 each would max distance then be 2.5 if we assume the sound is attached to the mesh (does attaching to a mesh centre the sound in the mesh?)
  19. An additional question: When we create spatial audio we define as such: new BABYLON.Sound("Music", "sounds/sound.wav", scene, null, { loop: true, autoplay: true, spatialSound:true, maxDistance:1.5, volume:0.3 }); The docs say the value of maxDistance - 1.5 here - is also in units. How does this distance value relate to e.g. diameter of a sphere of 5, what would the maxDistance value need to be to ensure the audio starts to play the moment the edge of the sphere is encountered?
  20. By the way, maybe I'm missing something here but as I mentioned in my first post spatial audio appeared to work fine (at least, with my limited tests) using the ArcRotateCamera so long as one moves the camera manually. It's only when the camera is parented and then the parent animated that the spatial audio has issues. If the issue is that this setup would work fine with any other camera then fine, I just wanted to be absolutely clear here. p.s. do you need my home address for the contributor patches @Wingnutmentioned?
  21. Thanks guys. So I've made the following change in my Babylon.max.js code (from line 4066 in your source code linked above): var matrix = listeningCamera.getWorldMatrix(); var world_position = BABYLON.Vector3.TransformCoordinates(listeningCamera.position, matrix); audioEngine.audioContext.listener.setPosition(world_position.x, world_position.y, world_position.z); and it seems to work fine, but can you see any issues with this patch? I'm wondering what the cost of calculating the world matrix and then transforming the camera's position using this matrix will be on the rendering pipeline.
  22. For the first link I was referring to the specific comment I've linked to, where DK says "However for future reference, as DK mentioned - I always use a parent node to provide the coordinate system by which objects are animated.". I throwing ideas at you hoping something will stick As for the second post, I don't know, but you could try and let us know the results.
  23. Does anyone know if there's a reason why spatial audio doesn't work when animating a camera towards a mesh that has an audio source either attached or placed in the same position? My project has an Arc Camera parented to a mesh, which is then animated around a scene. I've set up end points where the camera parent will animate to, with the idea being as soon as it approaches the centre of the target position the spatial audio will kick in. However, in practice this doesn't appear to ever happen and in fact the only way I seem able to get it to work at all is if I manually zoom or move the
  24. Oh you wanted locale movement? Sorry, I didn't read the full thread closely enough. Maybe this will help ? p.s. check this out if you need to convert from world to local
  25. For simple movement try adding this code: BABYLON.AbstractMesh.prototype.moveTo = function (targetPos, fps, frames, done) { var ease = new BABYLON.QuadraticEase(); ease.setEasingMode(BABYLON.EasingFunction.EASINGMODE_EASEINOUT); this.activeAnimation = BABYLON.Animation.CreateAndStartAnimation('at5', this, 'position', fps, frames, this.position, targetPos, 0, ease, done); }; This will attach a moveTo method to every mesh in your scene, and then you can simply call the function like so: myMesh.moveTo(new BABYLON.Vector3(x,y,z),24,96,function(){ console.log("Movement co
  • Create New...