• Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by JackFalcon

  1. Also "tachometer"... https://en.wikipedia.org/wiki/Tachometer
  2. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ....add(falseCamera.position))? And the tan(fov/2) is the sizing? -> From the billboard output plane of the aspect ratio in the fake camera field of view... almost got it. Nope not it... shader.setFloat('time', time); shader.setVector3('camOffset', output.position.clone().add(falseCamera.position)); shader.setVector3('camTarget', falseCamera.getFrontPosition(1)); How does it stripe material, and move in opposite direction (based on time)... Finally just reads the _fs and _vs. It's all there! : ) Thank you for the intro to WebGL shaders. : ) MOD: https://www.babylonjs-playground.com/#C0PXB0#6
  3. Yes, "Nixie tubes" === typeof "cool". <finally-clicks-it/>. And "meter-needle", hear you, caught it too [as a-design-difference]. !important; : ) Hopefully we progress from opposite sides to same-center... Ray, tangent, arc!?! Will try PG next week after: createSteamAchievements(32); And time for a FANTASTIC QUOTE (unrelated to everything): http://www.gimptalk.com/index.php?showtopic=44529#p339365 http://www.mahvin.com/2010/01/i-found-this-stone-texture-tutorial-for.html from the-old-days. ~ njoy. PS. for meter positioning calculation: Q: how about offset in localspace? - and/or as inverted [design-difference] -> from raycast at tgt (hit===cube-tip). Worth a try... : )
  4. .afalcon swoops in for the ... stuffed-bunny!?! ~ And fluffy-stuffing-flies in 100 random cross-product-dimensions... : ) Yep, building a radial-lock. Found same as describe above. QUESTION: How, to measure position precisely after [unlimited] rotations? (or GUIMeter). NOTION: concentric-sphere-facade over small-radial-cubes... STEPS: 1) Remove concentric spheres, and convert each radial degree into to many small cubes (OR rotated rectangles). 2) Material top of each cube (scale, rotate, etc). 3) Detect position precisely by local position of small-cube (and static-local-target-zones OR raycast on cube-tips?). 4) Parent small-cubes back to concentric-spheres (previously removed) and rotate parent. 5) Position small-cubes on y, so only the tips poke out of spheres (similar to angular tips on a lock OR radial-dividers). RESULT: Radial-Lock with sphere as facade. Design not (yet) attempted. Hope it helps GUIMeter. Will try 2 PG. https://en.wikipedia.org/wiki/Angle ~
  5. ~ afalcon loves Wingnut Chronicles and babylonjs. Thank you for the healthy discussion.
  6. I see a plane can be created as {sideOrientation: BABYLON.Mesh.DOUBLESIDE}, But is it possible to make a plane which is FRONTSIDE by default... and then DOUBLESIDE dynamically at runtime? CONTEXT: a plane is imported by blender (as a complex shape), it is DEFAULT FRONTSIDE. After many user interactions the plane then can become DOUBLESIDE . How to do this? Without it being DOUBLESIDE on the blender import. Feeble attempts in this playground: https://www.babylonjs-playground.com/#LXZPJK#53 There is a delay, and then tries to: 1) convert directly plane.sideOrientation = BABYLON.Mesh.DOUBLESIDE (no change) 2) and it seems possible to clone the mesh and re-create it with DOUBLESIDE (but complications with height,width, rotation, performance overhead, etc) So, curious: Is there a way to dynamically apply DOUBLESIDE to a plane? 3) if not, will probably blenderfix...etc. : ) Thanks,
  7. Woo-hoo... Yep applying world/local transform no big deal! : ) And about 75% on the space ship challenge...(still need to understand tangent, normal binormals) Guessing there might be a cross product in there somewhere.. Did some updates on the "car following a path" example.Using lookAt as orientation trick... Also have info from electron app near completion. Fascinating things with animation...interpolation with a config object:. anim({from, to, duration}).done() Update: wow that is an awesome example. Thanks! (ed) CatmullRomSpline yee-haw. Will learn groups (and test in electron app). Great to see you back @dbawel : )
  8. TIP: if you are writing a babylon App in Electron... and you have Web app and Electron app running simultaneously... you should know that your GPU will be split between the two! I had 5 running. And... it gets slow. : ] So the best performance optimization (was not scaling down the 3D world in blender, then scaling it up again in babylon) it was closing the Babylon Web App while working on the Babylon electron app. : )
  9. Thank you @JohnK! I get identity matrix, so that relation makes sense and is very helpful. Also... I will look for that ref in the src. +1!
  10. SOLUTION - here is a solution found to scale the transformCoordinate, thanks to the babylon docs, and a post from 2015( @gwenael ). If you know of an updated or more performant way please ping, otherwise, hope it helps someone else. //TRANSFORM-FROM-2D-PROJECTION-TO-WORLD-TO-LOCAL-SPACE-. var invertParentWorldMatrix = basePlane.getWorldMatrix().clone().invert(); var pickMoveVector = pickPointNext.subtract(pickPoint); //vector of mouse move, GLOBAL. var local_position = BABYLON.Vector3.TransformCoordinates(pickPointNext, invertParentWorldMatrix); //SCALE-TRANSFORMATION-TO-MATCH-PARENT-SCALING-. var originInLocalSpace = BABYLON.Vector3.Zero(); var move = originInLocalSpace.subtract(local_position).normalize(); var moveScaledInLocalSpace = move.scale(8).add(local_position); //SET-SCALED-LOCAL-POSITION-. pickObj.position.copyFrom(moveScaledInLocalSpace); pickObj.position.addInPlace(pickMoveVector); //MOVE-TILE-TO-POSITION-. BONUS: if you have insight on these related concepts, I would love to understand more about: a) why does a tiny then scaled up version of a mesh seem to perform quaternion rotations faster than a mesh imported at large scale from blender? (found that tip in a different old-thread, if I'm not mistaken) b) what is happening conceptually for "invert" ParentWorldMatrix, is it "invert" as in - expand from a smaller local matrix into a larger world matrix? c) in the subtract() scale() then add() sequence of calls (above), is that basically scaling the difference between the move point and the local origin? Really curious on how these things work at a deeper level, I'll dip in the src l8r... Hope this help someone. Thanks.
  11. @Pryme8 really cool. I did a hoverboard as well. The way you use an impulse is really nice. I couldn't figure out how to get it to rotate over uneven terrain... (using physics). So went non-physics way...
  12. This code converts a Screen Pick in World Space down to a Local Space on one side of a rotated cube, so that user can move objects around on each face of the cube... var invertParentWorldMatrix = northPlane.getWorldMatrix().clone(); invertParentWorldMatrix.invert(); var local_position = BABYLON.Vector3.TransformCoordinates(pickPointNext, invertParentWorldMatrix); pickObj.position.copyFrom(local_position); pickObj.position.addInPlace(moveVector); //MOVE-TO-POSITION-. Problem arises in optimizing the Cube. By making it small and scaling it up. The translation above didn't scale. The pick still moves, but at tiny-scale. So, the translation (above) needs to scale up to match the parent, northPlane. But it seems like the scaling is... lost in translation somehow? Any tips on how to scale up the transform above? Does it need baking? Thanks much, Looking around... : )
  13. Like your style. Question: GUIMeter... just want to see what it is. Couldn't find an example, or get (the one in playground search) to work... and thought you would be the best to ask. FYI: Above, playgrounds need "stable" version "latest" is saying __extends not defined. Interesting...
  14. lol. Thanks @JohnK I try PG. And I ended up going with your solution. @Wingnut... remember the square planet? Working on that. Didn't know wAng was a thing. Thanks. UPDATE: found ctx.rotate(), Tried it, and the img went black. Fun! New tool for a later day. Thanks for your help gentlemen. Oh great... the wAng solution was good. Not much I can say on that. Thanks for the tip.
  15. SOLUTION: //RayCast top of the world to find orientation. function getFarPlane() { //detects far plane to determine precise orientation. var planeItems = [boxigon1.top,boxigon1.north,boxigon1.east,boxigon1.south,boxigon1.west,boxigon1.far]; var direction = new BABYLON.Vector3(0,0,-1); var origin = new BABYLON.Vector3(0, 0, 165); var length = 10; var ray = new BABYLON.Ray(origin, direction, length); var picks = ray.intersectsMeshes(planeItems); //FARRAY-. var farPlane = ''; if(picks.length){ farPlane = picks[0].pickedMesh.id; } return farPlane; } //Then, use the orientation to rotate the tile to be readable. basePlane.initView = function(farPlane){ var dynRotation=0; if(farPlane==='platefar'){ dynRotation = Math.PI/2; } else if (farPlane==='platewest'){ dynRotation = 0; } else if (farPlane==='plateeast'){ dynRotation = Math.PI; } else if (farPlane==='platetop'){ dynRotation = -1*Math.PI/2; } if(dynRotation){ for (var i=0;i<txtTiles.length;i++) { var txtTile = txtTiles[i]; txtTile.rotation.y = dynRotation; } } } If there is a way to rotate txt ctx, please lmk... Thx.
  16. That is really awesome... and it could work. Looking... thanks. RadialGradient (rocks) and hello... AdvancedDynamicTexture Like: txtGUIs[adt].rootContainer._children[0].rotation = -camera.alpha - Math.PI/2; UPDATE: trying to detect Quaternion rotation (then apply adjustment), woah! What? Wikipedia... : )
  17. Hi @JohnK thanks. Yes playground not always possible to reduce to POC (for me [for whatever reason<maybe i try harder>]) Correct, single rotation works, but not in the case of rotating a 3Dworld (which is why playground not possible in context). Great playground. Question would be: how to get numbers to always face camera? Without rotating the tiles? Latest Code: txtTile.rotation.y = Math.PI/2; txtTile.billboardMode = BABYLON.Mesh.BILLBOARDMODE_Y; That works as well, as all the numbers are readable at all orientations. But lose grid layout (as expected). So, maybe solution is to detect world rotation and apply to localspace? Ah wait,... it would only be y rotation. Interesting... Otherwise, how to rotate the DynamicTexture (text)? Is there a way to rotate the ctx or drawText()? Thx.
  18. Dynamic Texture applied to Plane, is rotated sideways. Need it always readable, even after rotation. How to rotate DynamicTexture... like BILLBOARD_MODE? Here is the code: var txtTiles = []; function createTxtTiles(){ var txtTilePositions = [ {x:18,z:18},{x:-18,z:18},{x:18,z:-18},{x:-18,z:-18}, //deca {x:48,z:48},{x:-48,z:48},{x:48,z:-48},{x:-48,z:-48} ]; var txtTile; for (var i=0;i<txtTilePositions.length;i++) { txtTile = BABYLON.MeshBuilder.CreateBox("txtTile"+i, {width:32,height:1,depth:32}, scene); txtTile.parent = baseObj; //Create dynamic texture var textureResolution = 512; var textureGround = new BABYLON.DynamicTexture("dynamic texture", {width:512, height:256}, scene); var textureContext = textureGround.getContext(); var materialGround = new BABYLON.StandardMaterial("Mat", scene); materialGround.diffuseTexture = textureGround; // ground.material = materialGround; txtTile.material = materialGround; //Add text to dynamic texture var font = "124px fantasy"; textureGround.drawText(i+1, 255, 175, font, "steelblue", "white", true, true); txtTile.position.y = 1; txtTile.position.x = txtTilePositions[i].x; txtTile.position.z = txtTilePositions[i].z; console.log('f: '+txtTile.position) txtTiles.push(txtTile) } } Here is image of text needing rotation... Looking for BILLBOARD_MODE in DynamicTexture, doesn't seem to be there (https://doc.babylonjs.com/api/classes/babylon.dynamictexture) Probably need BILLBOARD_MODE on the Box? BABYLON.Mesh.BILLBOARDMODE_Y??? Thx.
  19. @dbawel Great thread, here are... pseudo-random question. : ) So, lots of questions but... the current journey is to understand: transforming points between spaces. HOW TO BEST TRANSFORM SINGLE-POINT from WORLDSPACE to LOCALSPACE... and back again? From a recent SUCCESS of a translation from WORLD to LOCAL: /*TRANSFORM WORLD COORDINATES INTO LOCAL*/ var invertParentWorldMatrix = tgtPlane.getWorldMatrix().clone(); invertParentWorldMatrix.invert(); var local_position = BABYLON.Vector3.TransformCoordinates(pickPoint, invertParentWorldMatrix); local_position.y=3; //local adjustment. pickMesh.position.copyFrom(local_position); invertParentWorldMatrix... does what now? : ) Oh wait, that is not my 1 question, (niether -> gimble lock - precise moves to break gimble lock? [anyone?] ) Refocus falcon: Here is the question... How best to TRANSFORM LOCAL COORDINATES from LOCALSPACE to WORLDSPACE? Looking... and found it. mesh.computeWorldMatrix(); var matrix = mesh.getWorldMatrix(true); var local_position = new BABYLON.Vector3(0,1,0); var global_position = BABYLON.Vector3.TransformCoordinates(local_position, matrix); Ok, So what is going on with the transforming, computing and inverting of matrices? : )
  20. @port9001 and @JCPalmer. I think I've reproduced this (exactly backwards) result a few times, and starting to understand it better. Here are my notes and potential workaround. And potential insight for a solution. Just recently experienced a "backwards" export from blender to .babylon. So got meticulous to try and figure it out as much as possible. The mesh was in a state of: rotated, applied, reverted origin to center mass, then rotated again (so as to export the rotation) RESULT = backward export. Why? This could reasonably happen in the case where a mesh export - need not Apply. HOW TO TEST THIS: 1) confirmed normals in blender vs. local showAxis() in babylon. 2) Y+ moves it Y- (in localspace). WORK-AROUND -SOLUTION: SPECIFIC CASE(again): a plane was rotated then applied, then origin to center to get origin location for translation and exported = backwards. Had to re-create the planes to avoid export pretzel - and it worked. 1) Re-created the planes. 2) transformed, scaled, and rotated. 3) DID NOT apply Translation in blender. (Instead use cursor center plane to maintain localspace placements to parent object); 4) DID NOT apply Rotation in blender. (to allow parent to pass rotation to child objects. check the mesh.rotation in debugger). UPDATE: 5) DID need to apply scale. What a tightrope. AND I see no way around this. The specificity is required. AND I think the problem is that it isn't very obvious in Blender. ... of HOW APPLY effect BABYLON WORLDSPACE/LOCALSPACE. What is a clear cut rule, of when to APPLY and when NOT to APPLY.... (is the question). So here goes: Emerging rule of Thumb: 1) APPLY RTS to remove localspace offsets (if you do not want them). 2) Do NOT APPLY if you wish to keep localspace offsets. 3) Depending on what you are building - Sometimes it is a MIX of what should be applied and what should not be applied in RTS. 4) If you get it wrong and apply something that should not be applied - if you go back - (reset origin) you might experience 'backward export rotation' (above). a) if that happens - follow the solution (above) of re-creating the mesh - without applying one or all of RTS (rotation, translation, scale). ... welcome to the jungle... : )
  21. It takes trial and error... there was one called 'minimum bone'. It wasn't easy. Ping back with questions after reading that. Pls.
  22. SOLUTION: Thanks to @Convergence and this thread... The solution of converting MouseMove WORLDSPACE into rotated child cube LOCALSPACE was: /*CONVERT WORLD COORDINATES INTO LOCAL*/ var invertParentWorldMatrix = parentObj.getWorldMatrix().clone(); invertParentWorldMatrix.invert(); var local_position = BABYLON.Vector3.TransformCoordinates(pickPointMove, invertParentWorldMatrix); childObj.position.copyFrom(local_position); Hope that helps someone else.
  23. Hello, How would WORLDSPACE Mouse Pick and Move (observable), translate into LOCALSPACE of a picked mesh? CONTEXT: a smaller child cube is picked and moved around on a parent cube. BEHAVIOR: without parent rotation, Pick Move works as expected. After parent rotation the following RESULTS: -Z move by mouse in WORLD SPACE results in -Z move of child object in LOCAL SPACE. So, it does not follow the mouse... in WORLDSPACE. GOAL: rotated LOCALSPACE child to follow WORLDSPACE mouse move (e.g. converting -Z mousemove into +X rotated child move). Strange but true. QUESTION: How to convert the WORLDSPACE mouse into LOCALSPACE ... and is that the correct way? The "Frame of Reference" docs are excellent. Found out that vectors do not work in TransformCoordinates. So, guessing that the World Coordinate on Move needs to be converted to local before the vector is calculated... then move the child in local space. Hmmm. Any tips or examples on something like that? Thx.
  24. For anyone that may find this. A separate way to reproduce the offset was in DevTools emulator (specifically). If this Zoom drop down is not 100%... there is a touch offset in the emulator (to lower left). By default it often isn't 100%. And it can change between every device (giving confusing touch results). So, always need to set to 100% before testing touch. It seems...
  25. @rothers, I got an electron game running great on steam. <party> It is possible. Also, found a significant workflow automation and decided to share it here. It isn't easy, you are right, I wish you luck. ~ELECTRON-To-STEAM App Build Workflow Optimization: - In package.json (with electron-packager) - added 'package' command (example build of Win PC app): "scripts": { "start": "electron .", "package": "electron-packager ./ AppName --arch x64 --platform win32 --out ./build --version 1.8.2 --overwrite --icon=img/logo1.ico" }, - It outputs to the ./build directory a win32x64 .EXE - with ./resources/app/... - which is where the optimization is. -> You can EDIT the entire html/css/js source directly. Then launch exe (with no build) and it is there. - So workflow is not refresh browser but relaunch exe. - Then, the steam-sdk run_build.bat has a path to that folder. ~So, it is a single(double)click to launch app into cyberspace. Hope it helps. : )