Snouto

Members
  • Content count

    53
  • Joined

  • Last visited

  1. FollowCamera events

    I aim to seize(ure). I aim to please... I aim to seize.... yeah never mind Your latest test is interesting. Mouse down inside an object, move ever so slightly so you don't exit the object, then release. no click (your previous test will register that as a click). But if you move the camera just enough to exit the object, then go back to the object and release, detects a click. very odd. Pity because we want the exact opposite! I'm not going to worry about this. Like I said, chances are this will be an edge case in my scene and worst come to the worst I'll stick some timer on the mouse down while recording the clicked mesh, and check the delta & mesh on the mouse up for a threshold amount of say 500ms, and if it's above that or a different mesh discard as a click. Not ideal but it will work I think. Or maybe use BABYLON.ActionManager.OnLongPressTrigger in conjunction with OnPick, setting a flag to true in OnLongPressTrigger that I check for in OnPick or maybe OnPickUpTrigger. If there's one thing I'm good at, it's hacking stuff together! Hmm well this is also interesting. In the scene class: /** The distance in pixel that you have to move to prevent some events */ public static DragMovementThreshold = 10; // in pixels /** Time in milliseconds to wait to raise long press events if button is still pressed */ public static LongPressDelay = 500; // in milliseconds /** Time in milliseconds with two consecutive clicks will be considered as a double click */ public static DoubleClickDelay = 300; // in milliseconds I wonder if there's something in there we can utilise. Seems like my previous plan using long press is being foiled, and looking at the code i think it's because the event is tied to initial clicks over meshes (it's not a general long press event) and also depends on that DragMovementThreshold value: https://www.babylonjs-playground.com/#199WQ0#6 If you click hold over an object without moving, the event is fired. If you move around though the event never fires.
  2. Great thanks, so it looks like I need to go in to the dope editor then change to Action Editor, where I can then pick and choose different animations and create new ones. sweet. I still have no idea why the ferris wheel animation is spazzing out though, doesn't appear to be anything wrong in blender.
  3. FollowCamera events

    Hey Wingnut Thanks for taking a look at my question, I like what you've done with the test scene you created. It's interesting that your approach seems to have a higher threshold for ignoring ground clicks than my demo did, so I'll try implementing the actions the same way you did. Probably the easiest way to avoid a click on the ground is to simply filter it out of the resulting event function; you already have it commented out with "//ground.isPickable = false;", so just need to add a check in the event and return if that isPickable flag is false. For my problem however, clicking the ground isn't so much an issue as discerning the difference between an intended click and a click - drag - release = click. So in your test scene you can click over a shape, rotate the camera with the mouse button still down so that the cursor exists the shape, then rotate the camera so the cursor is back over the clicked object, release, and it is detected as a click. That's going to be an issue for me at some point I feel. One might expect there to be a timed check between mouse down and mouse up that determines that "no, the mouse button has been down too long, this can't be a click" going on behind the scenes in the mouse events, but it doesn't appear to be the case. I dunno, maybe I'm worrying too much about that particular issue. My scene's main surface area is probably not going to be clickable so in reality the chances of someone mouse-downing over a clickable object, scrolling around, releasing over the same object, and not exacting a click action is probably quite thin. If that happens though I'll just look in to some timer based check.
  4. Out of interest is it possible to create seperate baked animations such that some can be started automatically and others only when I want via JS code? It seems to me everything I bake ends up in the same timeline, which for the chopper and wheel is fine but there's going to be other situations where this is not desirable.
  5. Slight update, I checked an additional animation option in the blender exporter "Only Current Assigned Actions" and surprisingly (to me) the helicopter and ferris wheel animations are now seperate and working... sorta... Here's the latest version: http://snou.to/tests/babylonjs/animation/test3/ The helicopter actually looks spot on, however for some reason or other the ferris wheel freaks out a couple times per cycle. If anyone can suggest what's going on there i'd appreciate being hit with the knowledge. Cheers!
  6. Animate Cloned Mesh Children

    I did this as a test not long ago and it worked fine: var fan=scene.getMeshByName("Industrial_Fan_1"); /* a mesh already loaded in the scene, with animations */ for (var index = 0; index < 10; index++) { var newInstance = fan.createInstance("i" + index); /* iterate the instance name */ /* Probably you'll want to reposition the new instance here. */ newInstance.animations.push(fan.animations[0]); /* copy the same animations from the original as these aren't carried over in the new instance */ scene.beginAnimation(newInstance, 0, 30, true); /* start animating the new instance */ }
  7. FollowCamera events

    Yo dudes In my continuing quest to work with Babs for my client project, I'm exploring how to control cameras in response to user actions such as clicking. As usual I have more questions than answers... The idea is to move the camera to a position in front of a chosen mesh within the scene. I've got a very simple scene going where, upon detecting a click, I create a follow camera, set its position and rotation to the active arc camera, then define the camera target and let it animate to it. Some questions on this approach: 1) There's a shift in position when switching active cameras from arc to follow. Any reason for this? I set position and rotation to match, but I must be missing something else from the arc camera when switching to the follow camera. Lets face it, I usual am. 2) Detecting a click is a bit of a pain. Not in itself, but when it comes to determining if the user was rotating the scene with the mouse button, or actually clicking a mesh in the scene, when releasing the mouse button it's less than clear. Are there any recommended strategies to follow for this? I looked at the ActionManager example PG (http://www.babylonjs-playground.com/?17) but it has the same issue; if you click down over one of the shapes, move the scene around a bit with the mouse button still down, then move the scene so the original clicked object is under the mouse when you release the button, it's considered a click. Seems obvious to me there should be some clear method to distinguish the two actions, but don't ask me what the solution is because i don't have a scooby. 3) Is there a way to detect when the follow camera finishes animating to the target? Looks like there isn't but I'd have thought this would be useful to someone (me) at some point (now). 4) Is there a way to reverse the animation of the camera. For example once the camera reaches its target, can we make the camera reverse back to where it started with a click of a button? Probably I'm expecting far too much and I'll have to consider other options (maybe create paths to clickable objects and animate the arc camera along them) but would be great to know for sure. Cheers!
  8. Thanks for that! I've had a look at that and extrapolated what I needed to do (bake animations along a path). Problem 1: If I only bake animations for one object, since it is following a path, the Z euler is updated to keep the object pointing in the correct direction. However after completing one full pass of the baked animation it looks like the object "unwinds", that is to say it spins on the spot 360 degrees and then continues to repeat the animation. It does this twice, and on the third pass simply keeps following the path like I expected it would in the first place. Problem 2: I actually have two simple animations in my scene, both using curves to generate movement along a path for two separate objects. Using animation baking I have baked the animations of each object and i can see both objects in the dope sheet as separate animation keyframe actions. Running the animation in Blender works fine, everything as you would expect. When i export to babylon however, both objects are combined in to one and they begin following the first path. When complete, both objects move to the position of the second object (as it was in blender) and start the second animation. Feels like I'm missing an important step or three here, and it is essential I get animations working smoothly for my 3d piece otherwise the whole thing will fail and I'll be in a world of pain. FYI to create the keyframes I first pick the object i want to animate (which is parented to the curve i want it to follow), then pick Object -> Animation -> Bake Action. From the bake sheet I sent frames 0-100 and checkbox the first 4 options. I've attached a grab to visualise this. I've also attached the blend files if someone can take a look; test_scene is the scene before any animation baking so you can see the original setup. Test_scene2 is after baking the helicopter animation so you can see my process. I've also added both exported babylon scenes online so you can visualise my issues: http://snou.to/tests/babylonjs/animation/test1/ - this is just the helicopter animating (problem 1) http://snou.to/tests/babylonjs/animation/test2/ - this is both the helicopter and the ferris wheel (which is just a squashed sphere) animating. (problem 2) I'm concerned babylon isn't going to do what I need it to do. I suppose I could always look to animate these things directly in babylon instead but it feels like a huge PITA compared to getting everything set up nicely in one place (blender) and exporting. Would really appreciate any insight and help here. The example scene provided by @JCPalmer is great but without any context it's difficult to use as a teaching aid. test_scene.blend test_scene2.blend test_scene.log
  9. wow that sounds horrible! Thanks for the tip, but hopefully I can find a much simpler approach.
  10. [Solved] Skybox config issue

    Excellent that got it, thank you! I knew there was something simple I was missing
  11. Hi guys I've just set up a regular ol'skybox for my scene exported from blender. The scene has a scale of 10 along the X and Y and 5 along the Z in blender. The skybox code is as follows; var skybox = BABYLON.Mesh.CreateBox("skyBox", 100.0, scene); var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene); skyboxMaterial.backFaceCulling = false; skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("textures/skybox", scene); skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE; skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0); skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0); skyboxMaterial.disableLighting = true; skybox.material = skyboxMaterial; skybox.renderingGroupId = 0; So far, so ordinary. The problem is when babylon renders the scene. With a particular zoom of the camera (camera is also exported from blender btw) it appears like the attached. Normally there's no issue using the skybox code shown above, this is the first time i'm seeing something weird. i thought maybe the 100.0 value in the createBox constructor was too small and so the camera was clipping part of the cube, but increasing it above 100 just makes the black area larger until it envelopes all. Reducing that number makes the cube smaller to the point where it's visible as a cube in the scene, which obviously isn't ideal. Am I missing something obvious here? Cheers!
  12. Hey dudes So I'm continuing along with my 3d project and I've been building a prototype scene in babylon in order to test the final experience and make a few decisions. Part of my test scene involves a helicopter going around in a circle, so in blender i created a bezierCircle, parented the helicopter to it and set the parenting mode to follow path. In blender this works great when running the animation. The big problem is of course (I soon discovered) that the babylon exporter does not support beziercircles and therefore ignores the path and the helicopter model (since it is now a child object of the beziercircle). So my question is; what is the expected way to set up things like follow path animations in Blender such that the babylon exporter will support it and babylon can play the animations automatically? Cheers!
  13. Firefox Mac scrolling page and scene

    A quick update and check later and... nope, still the page scrolls. This seems to be a bigger issue than I first realised. I'm going to mitigate the issue as best I can by showing a full screen canvas instead, as it seems any canvas that is not full screen will have this issue in FF58 (on Mac, at least). Thanks for your input.
  14. Firefox Mac scrolling page and scene

    Thanks for the reply. I'd appreciate a little more on this if possible because I took a look at the sandbox site and tested in Firefox. Sure enough the whole page didn't move but I have some observations: 1) the canvas is the full size of the page, with the bottom HTML footer absolutely positioned over it. In my situation the canvas is just a small part of the page. 2) I looked at the code and noticed the HTML element does not declare "touch-action"; it only appears to be defined in the CSS where you also define the Microsoft -ms- variant. In my setup I already have touch-action defined on the HTML element and in the CSS, so I'm presuming this is not related to the fix you mention? Incidentally I added that -ms- variant "just in case" it was critical (knowing full well it wouldn't be) and sure enough nothing changed. Would be great to get some further insight from you. Cheers
  15. Hi everyone So I'm back in to looking at Baylon after having to concentrate on other areas of my project first. I'm at the stage now where I'm loading a .babylon file exported from Blender, I'm attaching camera controls to the active camera (configured in blender to be Arc), and I'm using Pep instead of Hand for the interactions because Hand hates me and I don't deserve nice things. Anyway here's the issue, with the camera controls attached as so: scene.activeCamera.attachControl( canvas, false ); everything works fine in Mac safari 11.0.3 and Chrome 63.0.3239.132, but when in Firefox 58.01 the page scrolls as well as the scene when using the mouse wheel to zoom. I've tried setting that false value to true, but all that did was stop scene scrolling everywhere. The canvas element has the attribute: touch-action="none" set in the html and the similar declaration in CSS. This wouldn't be such a problem if the entire scene was the whole page, but in my case the canvas is only part of the visible page. Can someone shed some light on this please? Cheers