Wingnut

The Wingnut Chronicles

Recommended Posts

Hi again, Chronies! 

 

I have been playing with some potential new tools for BJS... mainly... something I call "fastmat".  It needs a util function as a helper and it does other retarded things... have a look...

http://playground.babylonjs.com/#MEZ7O#3

First feature, it honors web color strings.  Second, it creates a colored standard material... quite quickly and easily.

But... I'm a crappy programmer, so, please help me tighten this up.  Tell me suggestions, modify that playground, and teach me stuff, ok?  (thx)

I don't know if this junk will ever qualify as a tolerable feature to add to our Tools class... but maybe so... with the help of the Chronies (Wingnut Chronicles readers).

All comments, tightening, wisdom... certainly welcomed!  Thanks for the help!  Party on!

Edit:  Well that didn't work worth a hoot.  I had that playground running just fine... and then... noooo.  :)  (If failing, remark-out lines 3 and 4, and ALL test cases... then RUN, then undo all that... and it might work.)

Share this post


Link to post
Share on other sites

Thanks Temechon!  YAY!

I moved BOTH of the tool functions outside the createScene func now, and fixed two comment mistakes I made.

http://playground.babylonjs.com/#MEZ7O#6

----------

Ahiru (and anyone else)... pardon my potentially dumb question, but wouldn't socket.io in the playground... be a security issue?  Would that allow people to start a server on domains they do not own?  (thx)

Share this post


Link to post
Share on other sites

I guess you can use the genuine client HTML5 websocket API instead.

It's quite simple actually : https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications 

 

Note well that, if for some reasons (proxy, firewall, etc), you can't connect to the WS server, the default behavior of Socket.io is to fall back to a classic xhr connection (long polling).

This won't work in the PG because of the Same Origin Policies applied by the browser to xhr : the js code will have the PG URL for origin and it will try to connect your Socket.io server which will have another domain name, so another Web Origin.

 

XHR isn't allowed to request cross-domains while WS can.

Share this post


Link to post
Share on other sites

Hi again girls! 

   So, MeshBuilder, eh?  hmm.  Remember how I abbreviated the new Options Object Parameter Stocking thing... as "OOPS"?

Ok, so, MeshBuilder.  That's a big fat compensator, isn't it?  OOPS stumbled on the main line railroad tracks, and an emergency siding called MeshBuilder needed to be laid quickly, and then we winched OOPS into that siding... to clear the main line again, didn't we?  :)    Who knows the story of MeshBuilder?   Inquiring minds want to know.  heh

Speaking of MeshBuilder, here it is, used a few times... http://playground.babylonjs.com/#K1MLP

AltReality recently drooled over Sammy G's "piston" physics demo, because he does steam train stuff.  So, I decided that I would do some sneaky things and try to get a piston happening in Oimo or Cannon... and that demo above is the start.  After awhile, it seems that the bottom purple box is bumping into something... mid-scene.  Strange.  I think there is an invisible imposter sitting out there... possibly from the aligners.  Yuh yuh yuh.  I think I need to turn the aligner1/2 physics state... on and off in the renderloop... just like I do for "stead".  That way their imposters travel with the real mesh.  Probably body.body.updateImposter would do the same.

http://playground.babylonjs.com/#K1MLP#1

Or maybe not.  :)  Now we see the red box (link1) refusing to fall... as if dancing along the edge of an invisible imposter.  This might indicate that line 47 and 51, where I used OOPS to create the aligners... is not being recognized by Oimo imposters.  Oimo thinks the aligners are sized 70, 70, 70.  Maybe I need to SCALE the aligner plates to the wanted size, not OOPS them there.  yuh yuh yuh.

http://playground.babylonjs.com/#K1MLP#2

Or maybe not.  :)  In that last demo, lines 46/47 and 51/52... build the aligners in a non-OOPS way, and use standard scaling to size them up... no change.  Hmm.  Back to work we go.

http://playground.babylonjs.com/#K1MLP#3

There we go.  I had a few too many things in the render loop, and a few too little values in the aligner setPhysicsState.  :)

http://playground.babylonjs.com/#K1MLP#4

I don't think that I have much of a future in the rail industry.

-------

If you switch to Cannon in the line 39/40 area, you get a c.addShape is not a function error.  Just thought I'd pass that along.

In the demo, I am endeavoring to use the side planes called aligner1 and aligner2... to keep the boxes in-line as they swing.  Essentially, I am trying to keep the pendulum arm from twisting.  A good steam-engine driver-piston must not have bearing wobble.  :)

Feel free to "run with" this beginner piston code, and show me your saves/experiments, if you want. 

I have future dreams of a game called "Luge Run"... where we are riding through one of Jerome's tubes... with our "stead" tracking down the curve3 path, and our luge attached to an invisible pendulum arm.  We should be able to get those delicious banked corners on our varying-diameter tube-luge ride.  Wow!

Somebody made a curve/path-following roller coaster playground demo already, right?  Does anyone have the URL for that?  Thx! 

Yeah... Luge Run... sliding a pendulum down a curve3 with physics active... weeeeee!   Inertia On!

Share this post


Link to post
Share on other sites

Wow, that's a heavy read.  Thx for catching me up, VP.  

 

Poor Jerome... he could use a moist towelette, me thinks.

 

:)  I'm not sure if he's eating or sleeping AT ALL! 

 

He popped a gasket, eh?  nod.  Seen it before.  Moist towelettes to the rescue.

 

Sorry Jerome.  You were handcuffed from the get-go... and that's what most sucked, right?  Now you have some elbow space, right?  Walk it off, you're doing great!  Now you have your own wing attached to the headquarters building, and you can decorate it properly.

 

We're talkin' metaphors and symbolism here, kids.  Why?  I have no idea.  :)

Share this post


Link to post
Share on other sites

Hi kids.  Been studying Oimo... trying to find a decent API map for it.

 

Recently, I found this... https://github.com/humbletim/Oimo.js/blob/master/build/OimoPhysics.dev.comments.json

 

It's the comments from the Oimo source.  The section I needed info-about, was in Japanese.  So, I Google-translated those areas into English, and republished...

 

http://urbanproductions.com/wingy/babylon/misc/oimo_comments_in_JSON.js

 

It's not exactly OimoJS docs, but it ain't bad.  Steal at will.  You can also take it to an online json viewer such as http://jsonviewer.stack.hu/

 

If anyone knows where there is a REALLY NICE API map for OimoJS and/or OimoPhysics, throw me a url, eh?  thx.  Party on!

Share this post


Link to post
Share on other sites

Hi friends!  A little update on the Oimo JSON comments file... mentioned earlier.

http://urbanproductions.com/wingy/babylon/misc/oimo_comments_in_JSON.js - has been cleaned... lots smaller and less cluttered, now.

http://urbanproductions.com/wingy/babylon/misc/j2h02.htm - a self-contained HTML document made FROM that JSON.

Both are easily steal-able via right-click on those links -> save link as...  (or something similar) or use your browser's FILE menu to save the page.

I REALLY wanted the "subject" to happen before the "comment", but I was too scared to attempt automated json object adjusting.  Next time.  :)

PS:  http://doc.babylonjs.com/tutorials/Using_the_Volumetric_LightScattering_post-process - last demo... http://playground.babylonjs.com/#UUXLX#2 ... is broken (CSG).  Thought I'd mention it.  It's caused by line 63... 6th parameter in createCylinder...  looks like it went mandatory again.

Share this post


Link to post
Share on other sites

Hi gang!

   Well, Raanan is turning-on heightMap physics for CannonJS... when used in BabylonJS!  How good is THAT?!  Too good, that's how good!  Thanks Raanan!  Excellent!

There's lots of other great things happening in the forum/framework, too... and the ingenuity, expertise, artistry, innovation, and kinship seen... has never been stronger and more amazing.  I love what we're doing!  Things couldn't be going more positive and spirited, in my opinion.  I'm having TONS of fun hanging-around this place, and learning at light speeds.  Too fun!

With the coming of heightMap/displaceMap physics... a new area of study could use some fire.  Dynamically-generating (using JS code to create...) black and white 2D images for use in BJS DynamicTextures (which then get applied to hi-rez physics-active ground planes).

To be brief... "the bowl".  Let's look at a bowl-like heightMap/displaceMap texture that I made in Corel Paint...

http://urbanproductions.com/wingy/babylon/misc/bowl01.png

I don't operate 2D paint programs very well, but the image made me think. I thought about the "rings" of the bowl, and about how many gray scale colors I have to work-with.  Then I thought about having code assist me in managing my black-to-white color interpolation (color-change per bowl ring), and I thought about various kinds of bowls and their tapers.  Para-bowls and hyper-bowls  :D 

What did I deduce?  Yep, we could use a dynamic bowl image generator.  Yay!  And there could be MANY gray-scale "patterns" that could be generated with fairly simple algorithms!  With the right "magic"... I think we could make one of Raanan's balls roll-along for a REAL LONG TIME!  Marble madness, for sure!  :)

SO, geniuses... let's hear some thoughts... or maybe... let's see a dynamicTexture from a code-generated HTMLContext2DObject with a Raanan sphere rolling along on it.  Wow.

And, if anyone wants to publish my bowl image at a CORs-legal location, or in the playground's textures/ folder... please feel free to do so.  It will be an easy heightMap to turn-on, but I think we need more "bowl taper" options... and thus we need a dynamic bowl-pattern generator.  Big dogs... come on along and sing our song... even the experts are welcome on THIS fun project.

Me?  I have another project... learning about the Oimo "joint", (and some general BJS docs work which I'm still procrastinating-over).  :)  Good luck!  Use this thread for play-by-play coverage, as wanted.  Thanks!  Be well, gang! 

Share this post


Link to post
Share on other sites

Marbles in a bowl! http://www.babylonjs-playground.com/#DLBW7 . Marble madness it is! (Just be patient with the assets, loading take time for some reason)

 

My first post in the chronicles!!  :D

 

And this is the same, but a bit deeper - http://www.babylonjs-playground.com/#DLBW7#1 . more fun!

Share this post


Link to post
Share on other sites

That's great!  And that second one is REAL ready to use a code-generated image instead of a URL... YUM!  Start applying Bezier easing of the gray scales... drawCircle, drawCircle, drawCircle... curving the contour of the bowl with the colors!  WOW!

 

It's ready!  Choose single sphere, strap your camera to the ball... wheeeeee haaaaa!

 

http://www.babylonjs-playground.com/#DLBW7#2

 

Ok, what's next?  http://cdn1.spiegel.de/images/image-446084-galleryV9-xuxz.jpg  ;)

Share this post


Link to post
Share on other sites

@Raanan

 

I guess it's more a CANNON problem than a Heightmap problem but everything works well in FF, Chromium but not Chrome on my Ubuntu14.

The spheres don't appear at all.

 

Here's the error log I get :

 

Uncaught TypeError: CANNON.Heightfield is not a function

t._createHeightmap @ babylon.js:19

t._createShape @ babylon.js:18

t.registerMesh @ babylon.js:18

t._registerMesh @ babylon.js:15

i.setPhysicsState @ babylon.js:5

(anonymous function) @ VM72:23

d @ babylon.js:10

s.onload @ babylon.js:3

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.