Jump to content

The Wingnut Chronicles


Wingnut
 Share

Recommended Posts

https://www.babylonjs-playground.com/#CNMNR#1

What a gorgeous playground!  FacetData festival!  Who did this one?  I bet it was Jerome or Adam.  (them guys are amazing!)

Sometimes you can identify a @jerome PG by his "Jerome Gray" background colors.

scene.clearColor = new BABYLON.Color3(0.35, 0.35, 0.42);

He went thru ALL that typing to create a clearColor command, and then set it almost identical to default.  hehe.  Gotta love him.  :)

Link to comment
Share on other sites

Hi CB! 

haha.  Yeah, good question.  That playground is a "facetData" (development?-) demo...  doing physics-like things... without using a physics engine.  It manages to get MANY THINGS moving at the same time, eh? 

Hi Jerome!  Great PG!  Amazing, wonderful, and grand.  *sigh*  You're a God! 

CB, I dunno.  I would probably start with a SPS particle system... (solid particle system) using a few leafs as models for it.  Use a custom startPosition function to place the SPS particles around the tree branches. Put some special properties on them, called windSpeed and windDirection, and then... populate the branches... using the "easily-add-a-custom-startPosition-function" feature of SPS.

Now... you will also use a custom SPS updateParticle function... which is a continuously updating function... needs to run fast... and it will use particle.windSpeed and particle.windDirection... to "tilt" the leaf properly.  Then... drool-from-the-cool.  :)

How are you at creating Perlin noise-based windMaps?  :)  Thoughts?  Anyone?

Aw heck, just look at this... http://doc.babylonjs.com/extensions/sps_tree_generator

Are you going to be THE FIRST to fire-up that tree generator... in a playground, CB?  Coooooool.  :)

Link to comment
Share on other sites

Hi gang.  I did some experiments on the new mesh.addRotation() func.

https://www.babylonjs-playground.com/#AGXDE#7

I made some nice "step" vector3's in lines 85-87, used in lines 90-92, and then... I decided to read the docs,  because I was doing it incorrectly. :)

Just put the values directly into the params... lines 93-95.  You can activate line 96, too, because, early in the code... I installed rotationQuaternions for all three colored boxes... lines 52-54.

Had I NOT done that, line 96 reports to console:  undefined   undefined  undefined.  :)  

Mesh.addRotation... "accumulates" rotation, as you can see.  An interesting new feature, seemingly quite similar to addInPlace and addToRef, but those are Euler-only, I believe.

Link to comment
Share on other sites

Hi again.  For anyone who might want to follow-along on The Great HeightMapPhysicsImpostor Repair Adventure...

http://www.babylonjs-playground.com/#1RKZXB#18

Haven't you always dreamed... of having ghostly green mesh... SHOW YOU where the physicsImpostors are positioned/oriented?  Well, there ya go.

But this is much "heavier" (hippy talk) than just a ghost impostor.  In lines 1181-1220, I use a "copy?" of the framework code (from lines 1013-1045) which is used by the framework... to orient and position the physics impostor... for heightMap physics.  I borrowed some code from the framework, and changed this to that  :)

In short, I tried to do the exact same rotating and translating on my green ghost... as Raanan? did for the original code.  Keep in mind that CannonJS does not "center" its heightmaps (see line 1023). 

Take particular note of MY lines 1217-1219 (the pivot shift).  Compare to framework code lines 1024-1026.  Remark-out MY lines... and see the ghost return to center!!!  OMG!  :)   Right now, my ghost is showing exactly where the physics is active.  If you wish, now de-activate 1217-1219.  Center-up.  :)

My ghost's dimensions are only HALF what they should be.  It begins with a bad dim variable in line 950... reporting 250, when it should report 500.  Is mesh.getBoundingInfo().boundingBox.extendSize only returning HALF of what it once did?  WAS it diameter, now radius?  hmmm.  ;)

Now back to the ibox green ghostmesh... defined at line 1169+, you can see that it derives its SIZE... using the very same bounding box measuring tools... as were used up in DIM area.  SO, my ghost is also 250... (incorrect per the heightMap mesh).  Insert *2 at the ends of line 1171 and 1173, and my ibox will be same size as terrain.

So, that's what I have learned SO FAR.  Perhaps I turn OFF the framework's pivot translation, and fix the DIM line... and maybe things will start working?  I'm scared.  HELP!  I'm in over-my-head!  :D  The dog has been missing for 3 days!

Link to comment
Share on other sites

Oookay... whelp... here's the latest.  http://www.babylonjs-playground.com/#1RKZXB#21

Nothing special, just doing lots of reporting to console, including the line numbers that built the data FOR those reports.

That... line 1035 translation: {X: 0 Y:0 Z:-500} looks... suspicious.  I think a {X: 250 Y:0 Z:-250} (or an inverse of that) ...would be better.

If a CannonJS heightmap "origin" is in the lower left corner... and BJS heightMaps have origin at center... then... umm...  not sure WHAT can be deduced.  heh.

I've tried some forcings on the impostor (none on green ghost box code).  NONE of my experiments... caused a change in symptom.  I tried FORCING a translation of 250, 0, -250, and the impostor was still in same 25 % of terrain.  No change at all!  What the heck?  :) 

Lines 1053-1056 actually set the position and rotation of the impostor... but it does it for ALL impostors, not just heightMap.  SO.. if you put a console.log report in that section, it will be called 21 times - 20 boxes and 1 ground.

What is a deltaPosition, you ask?  See line 997 (located in a done-to-all-impostors area).  Initial position work is done in lines 999-1001... for heightMaps, too. 

In line 1018, IF HEIGHTMAP... then... "special adjustments needed" -section (1019-1046) is applied/run.  A "massaging" of the initial position and rotation.

Learning learning learning!  A good thing, but, I'll still welcome ALL help!  Wholeheartedly-so, and with vim and vigor and zest and zeal.  :D 

This IS time-sensitive... to me.  There's users waiting for me to hit pay-dirt. (oh no!)  :)  Help if you can, please.

Link to comment
Share on other sites

http://www.babylonjs-playground.com/#1RKZXB#24

Yay!  Physics active across entire terrain!  Mesh falling-off edges properly!  And I saw the dog run past the house once this morning.  :)

I force-set an X and Z in lines 1049 and 1050.  hmm.  Line 1046 definitely needs a re-think.

But... YAY!  (Wingy dances around like an idiot)

These boxes slide-around on this terrain real nicely.  I'm thinkin' maybe the bobsled needs some skis, with long-throw independent suspension (physics joints with springs).  Perhaps computer-controlled auto-leveling and anti-belly-scrape under-thrusters!  WOW!  Then we'll tilt this terrain, climb aboard, and break our necks in a bobsledding accident.  Alright!

@chicagobob123, ya got that tree generator working in a playground, yet?  Let's go... we need some trees to smuck-into during our bobsledding runs.  :)  (no, we don't NEED blowing leafs, yet.)  heh  Keep in mind that the tree gen code I pointed-to... is made from SPS particles.  And @jerome, (author of Solid Particle System)... being a nice guy and reasonably nearby... might help us make the leafs blow in the wind.

Jerome is also an action-hero in Paris cinema.  His latest movie is "The Orthogonoids",  and he is also playing Pete Pythagoras in le Théâtre des Arts de Rouen's production-of...  "Vector Vectoria"  :)

Link to comment
Share on other sites

Okay, here we go again with another CannonJS heightMap physics test - version 30.

Seems to be working fine.

Phew.  There's SO MUCH INFO being sent to console... that it is just ridiculous.  Why?  Because I am planning a PR to the CannonJS plugin.  Holy crap, huh?

I'm pretty scared.  Geez, I hope the github core admin... knows how to revert smoothly, because I have very little confidence in my programming skills.

If you'd like to go on a SIMPLE tour... let's go.

In line 1053, @RaananW did a likely-once-necessary "late-adjustment" of this._tmpDeltaPosition.y, a value established earlier, in line 1046.

In MY studies, I discovered I needed to do a similar late-adjustment to this._tmpDeltaPosition.z in line 1059.

BUT... we can remove Raanan's late-adjustment, and do ONLY MY late-adjustment... IF we remove the .subtract(c) from line 1046.

Let's give it a try...  http://www.babylonjs-playground.com/#1RKZXB#31

Still working good, for me.  I welcome tests and ideas and comments and help.  These mods will only affect heightMaps, and only CannonJS plugin.  But still... I'm scared.  :)  There is no "mirror" function on the OimoJSPlugin, so no upgrade/PR needed for that.

@RaananW, @Deltakosh, @everyone... please please please check my crap, and feel free to do the PR yourselves, and take full credit, because I'M SCARED!  What if it fails?!  What if I did something stupid?!  I'm a nervous wreck!  Comments welcome... begged-for.  :)

Link to comment
Share on other sites

:)  Ok, more testing needed, then.  :)

Actually, I want to slim-down this PG to only the necessary change-part.  Triple-check my stuff.  My dog looks worried.  Comments still welcome, from anyone.  I am thinking that the entire positioning SECTION could be re-coded... slimmer.  But, I'm not at-all qualified for anything like that.  :)

(Wingy dons FOUR crash helmets and heads-in) 

Link to comment
Share on other sites

*nod*  Oooh, that's a different kind of microphone.  I'm not familiar with that microphone... and it looks "official" and spam/whimsy-discouraging.  :)

But yeah... that makes sense.  GitHub still feels like "the vault", though.  And you don't mess-with The Vault unless you have a vaultmaster's license.  I'm not worthy.  heh.

Yeah yeah yeah, more experience == get worthy.  *sigh*  I'm scared.

Yay, stripped-down playground demo... still works!  Holy cow!

Little-edit PR's are better than entire-func paste-in PR's, I hear.  Easier on Admin eyes.  Can do, I think.  (Dog just fainted.)  :)

I had to get a new Firefox, cuzzzzz... CSP security blockage at GitHub... with FF 50.  Now 53.  Woah.  Testing demo one more time.  IE, too.  :)

Link to comment
Share on other sites

Hi gang!  Hey, a demo for our...

Professor Hart/Professor Stemkoski polyhedra.json "library"

....was broken for a few days (a change in mime-type stuff at GitHub), but kind & speedy Deltakosh repaired it for us, using "rawgit".

http://www.babylonjs-playground.com/#21QRSK#11

Ain't it pretty?  Control-drag to slide-around the target... for this no-lockedTarget ArcCam.

That playground was originally built by Jerome (thx J!)... and I love it.  But it WOULD be cool if we had math formulas to "derive" all those shapes, instead of using pre-plotted coordinates.  Oh well, perhaps someday.  :)  Maybe when Professor Hart is old, and on his death bed, we can hire thugs to make him "cough-up the formulas".  hehe.

His daughter "Vi Hart" is pretty much a genius, too, (I adore her 3-part Fibonacci video series) and with enough "coaxing" (booze?)... we might get some "insider trading."  :o

It is odd that version #1 demo at bottom of polyhedra library page... still works fine.  hmm.  Anyway, we can drool over the #11 version again, now.  Thx DK.

Link to comment
Share on other sites

On 5/8/2017 at 10:13 AM, Wingnut said:

"ya got that tree generator working in a playground, yet?"

:( No sorry. I am just being beaten up by old software have to maintain. Just when I thought I was out, they pull me back in

Ahh well back to slogging through code 

 

 

Link to comment
Share on other sites

Ahh, you are primary custodian of some legacy stuff, eh?  "He's the only guy who knows how that all works",  right?

Yeah, you're doomed.  That software will drag you around from owner to owner, and it doesn't slow-down for curbs or interstate traffic.  :)

Sorry, guy.  If there is ANYONE else who knows how to drive that code... ya gotta start greasing their palms RIGHT NOW...  they are your only relief driver, should you ever need one, and it sounds like you already DO.  :)

Oh well, it's good to be loved and wanted, right?  (Wingnut searches frantically for a positive)  heh

Link to comment
Share on other sites

Oh geez, http://www.babylonjs-playground.com/#1RKZXB#35

Non-square terrains... still got problems.

Line 88 - terrain 200 x 600 ... impostor failures... impostor-sizing and ground sink-in problems... sigh.

Set it to 600 x 200, CannonJS error.  Darn. 

Back to work, Mr. Wingnut.  PR aborted (soon).  Piss-poor testing on Wingnut's part.  hrmph.  :(

Wingy staples his dog to a kitchen cupboard in preparation for upcoming brain storm.  :)

Note:  IF #35 seems slow-motion, even though FPS is fine, try loading #31 for a moment, then go back to #35.  That worked ONCE for me... to put #35 back into fast-mode.  :)  Only tested in FF 53, and only tested once, so far.  Interesting.  Tests/ideas welcome, always.

Link to comment
Share on other sites

Hi girls.  http://www.babylonjs-playground.com/#1RKZXB#37

Nothing new.  Same mods as in PR, but using a 200x600 ground.  (My PR code did not pass "rectangular terrain" test.)  :(  Works great for square. 

So, I keep working.  Green 'ibox' is back, in an attempt to "showImpostor = true".  Failing, as you can tell.  Green box appears to be off in his own world... not paying attention to anything.  Line 114-135... is ibox (green box) sizing/positioning/orientation HELL -area.  :)  That's where current work is happening.  Help welcome.

I did learn one cool thing (thx Raanan).  Cannon heightfields have z-axis being vertical.  Interesting.  So, not only is heightfield origin different from BJS heightmap origin, but axes issues, too.  hmm.

As you can ALSO see, there IS some muddy-ground-physics active on the north-side of town ("muddy" means colliding impostors are sinking into the terrain too far).  Apparently Mr. Impostor is active near there, but green ibox has no clue that the impostor is up there.  Green box is one confused little puppy.  :)

I'm sending a few things to console... so if you're following-along at home, be sure to tune-in for those.  I'm printing BJS impostor-class .getObjectExtendsSize(), and .getObjectCenter().  Also printing ground.physicsImpostor.physicsBody.aabb.upperBound and aabb.lowerBound... and then subtracting lower from upper, using Cannon's vsub subtaction method.

Result of vsubtraction()?    infinity, infinity, infinity  :)  PERFECT!   That is exactly how long it will take Wingnut to finish this adventure.  heh

And of course, reversing the dimensions... to 600x200... makes CannonJS gag and barf.  Fun!  

Interesting finding:  In this report from user - " MESH_BB after transforming = 1.7976931348623157e+308,1.7976931348623157e+308,1.7976931348623157e+308,-1.7976931348623157e+308,-1.7976931348623157e+308,-1.7976931348623157e+308; SCENE_BB = 1000000,1000000,1000000,-1000000,-1000000,-1000000  babylon.2.5.max.js:5410:13 "  Those 1.79 numbers are the same numbers reported from my ground.physicsImpostor.physicsBody.aabb.upperBound and aabb.lowerBoundhmm.

Ahh, rectangular terrains... gotta love 'em.  :)  Hey, what ELSE would I be doing if I wasn't t-shooting an issue, eh?  It's not like it's musky fishing season or anything like that.  heh.

Link to comment
Share on other sites

Okay, more fun.

In this commit line... this.center.scaleInPlace(0.5); was seemingly removed.  Doesn't that still need to be done, because many things depend upon .center instead of .centerWorld?   Thoughts, anyone?  Am I grasping at straws?  :)  There sure are MANY .scale(0.5) in boundingBox.ts.  Still learning.

In latest test of never-ending issue.  I console-log boundingBox.minimumWorld and boundingBox.maximumWorld first.  They seem fine.

Then I output...
- un-modded boundingBox.extendSize
- boundingBox.extendSize.scale(2)
- un-modded boundingBox.extendSizeWorld
- boundingBox.extendSizeWorld.scale(2)
- un-modded boundingBox.center
- boundingBox.center.scale(2)
- un-modded boundingBox.centerWorld
- boundingBox.centerWorld.scale(2)

By looking at the numbers in the console, I can easily deduce... nothing.  :D  But if I stare at them LONG enough, it will be lunch time.  :)

Link to comment
Share on other sites

Ok, here's an interesting test.

http://www.babylonjs-playground.com/#1RKZXB#40

That is the original CannonJSPlugin.prototype._updatePhysicsBodyTransformation() func from BJS PREVIEW release.

When used on a physics heightMap in BJS 2.5, it works fine, as you can see.  (rectangular grounds still don't work, though)

BUT... now I CAN make a deduction.  Something changed in the framework PREVIEW release... but the problem is NOT CAUSED BY CannonJSPlugin.prototype._updatePhysicsBodyTransformation() func.  Something at a different place in the framework changed... and caused ._updatePhysicsBodyTransformation() to start mis-calculating things.  hmm.

I got this bug's number, I do.  I'm hot on its trail.  :)

New playgrounds ahead... and we'll be jettisoning the ._updatePhysicsBodyTransformation() function from future PG's, and begin hacking... umm... boundingInfo/boundingBox.  That's what ya call "Thinking inside the box"... errr... something.  :)

As before, if you get stuck in slow-motion mode, go browse #31 in the series, and then head back to current (#40).  It has worked consistently for me... to escape slow-motion mode. :)

update:  Here we go... basic test PG with original problem of... physics in 1/4 of terrain only.  On-board with us... is boundingBox and boundingInfo.  Now... let the games begin, Mister Evilbug.

DID I SAY only 1/4 of terrain is physics active?  Not any more.  Here's what I now see... with #42.  Scene is working fine when in FAST-mode.  Full terrain physics, in both FF and IE. 

If either browser goes into slow-motion mode, then only 1/4 terrain is physics active, again.  What the hell?  hhmm.  Geez, I hope this isn't a "Wingnut's computer only" issue.  Anyone else seeing ANY of this stuff?  Maybe I'm losing it.  :)

Link to comment
Share on other sites

  • 2 weeks later...

Hi gang.  While I'm waiting for anyone else to verify this physics/boundingBox issue, I wanted to point-out something else.

User @ben_a_adams, who kindly refactored our vertex buffers... making them "interleaved" (sounds scary), once provided a nice link to an English talk about networked physics.  Worth a view, I think.  Thx Ben... and Glenn.  :)

That Glenn Fiedler guy says "Quaternions" really fast!  Listen carefully.  heh.  Also, when he says "at-rest"... that is the same as our "isSleeping".  He also says "at-rest" very fast.  Fast talker... but... Glenn has definitely done some comprehensive (meticulous/detailed) tests about networked physics.  He summarizes the different methods... real nicely.  (~ 1-hour video presentation) 

I even understood some of it!  Wowzers, Penny!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...