Jump to content

The Wingnut Chronicles


Wingnut
 Share

Recommended Posts

I look for new basic mesh ideas (I added TOrusKnot this time)

 

It would be interesting to have plane circle (with just a radius). now we can make plane four dimension, but to an ocean, I think it's better with a circle.
 
What do you think?
Link to comment
Share on other sites

Hi dad72.  Good question.  I know that question is for deltakosh, and he will likely give an opinion soon.  But if you don't mind me interrupting yet again, I know a way to fake that, too.

 

You can make a cylinder like this, of course:

// args: name, height, diameterTop, diameterBottom, tessellation, scene, updatablevar cyl = BABYLON.Mesh.CreateCylinder("Cylinder", 0, 3, 3, 32, scene, 1);

See the height = 0? But that does not work, because of a line in BABYLON.VertexData.CreateCylinder:

height = height || 1;

That line forces the cylinder to have a minimum height of 1.  But now for the trick:

cyl.scaling.y = 0;

That makes the cylinder be flat... and gives you a 32-sided circular plane... but not really.  It is an artificial circular plane.  There are still 64 vertices (tessellation = 32), because it is still a cylinder. It has 32 vertices on the top, and 32 vertices on the bottom.  The top and bottom are located at the same Y location... so the cylinder has no height.  Also notice that backFaceCulling = 0... does not work on a plane that is created in this way.

 

A TRUE, REAL 32-vertex circular plane... would have only 32 vertices, and not 64 like this fake circle plane.  You can also make a fake triangular plane, too.

var cyl = BABYLON.Mesh.CreateCylinder("Cylinder", 1, 4, 4, 3, scene, 1);cyl.scaling.y = 0;

Tessellation = 3... triangle.  Set tessellation = 5... pentagon, or tesselation = 6... hexagon, or tessellation = 8... octagon, etc.

 

It is fake, and it does not answer your good question.  But you can also see that maybe it would wise to make:

BABYLON.Mesh.CreateFace(name, number_of_sides, scene, updatable)

This way, the 'number_of_sides' could be 3,4,5,6,7,8, ...32, ...64, anything.  And, backFaceCulling = 1 ...would again operate correctly... because CreateFace() would not make a two-sided mesh... like the fake does.

 

Again, sorry for the interrupting.  Your idea is interesting. It made me experiment with a flat cylinder... which was fun.  Now we will see if deltakosh has thoughts on this.  Be well!

Link to comment
Share on other sites

Is 'tessellation' (be careful of spelling) the same as "number of sides", just like CreateCylinder?  I suspect yes.

 

I don't think 'CreateCircle' is a good name.

 

Any chance it could be named 'CreatePolygon' or something similar?  By putting 'circle' in the name, users will not know that it can also create triangles, quads, pentagons, hexagons, octagons, etc etc.  Of course it is not my call, but, let's think this through.

 

And... do we foresee these meshes ever having an 'extrude' feature/function?  Can they scale?  On which axis?  Will they default to negativeZ-facing like a plane, or positiveY-facing like a ground?  Let's slow this semi truck down so we can make a safe corner.  :D

 

And Gwenael... shouldn't you be saying "Please, let's start a separate thread to discuss this"?  ;)  Now that it's a REALLY good idea to do that, you don't say it!  What the hell is the story with that?  hehe.

Link to comment
Share on other sites

Is 'tessellation' (be careful of spelling) the same as "number of sides", just like CreateCylinder?  I suspect yes.

 

Yes, sorry for the typo.

 

 

I don't think 'CreateCircle' is a good name.

 

Any chance it could be named 'CreatePolygon' or something similar?  By putting 'circle' in the name, users will not know that it can also create triangles, quads, pentagons, hexagons, octagons, etc etc.  Of course it is not my call, but, let's think this through.

 

Of course, it could be CreatePolygon and tessellation would be replaced by numberOfSides but does everybody know that a circle is a polygon with an infinite number of sides? ;) CreateCircle should exist too and it would internally call CreatePolygon. Tessellation would be converted to numberOfPolygons.

 

 

And... do we foresee these meshes ever having an 'extrude' feature/function?  Can they scale?  On which axis?  Will they default to negativeZ-facing like a plane, or positiveY-facing like a ground?  Let's slow this semi truck down so we can make a safe corner.  :D

 

Thanks to the new geometries system, it won't be difficult to add this. Once the geometry (a circle for example) is used by at least one mesh, its parameters can be updated (its height for example) and it can be regenerated to reflect the changes for all meshes using it. Each mesh has its own scale apply to this geometry. Each mesh has its own rotation too.

I suggest to create them by default as they would be created in 3ds max or blender.

 

 

And Gwenael... shouldn't you be saying "Please, let's start a separate thread to discuss this"?  ;)  Now that it's a REALLY good idea to do that, you don't say it!  What the hell is the story with that?  hehe.

 

http://www.html5gamedevs.com/topic/6364-circle-geometry-polygons/

Link to comment
Share on other sites

  • 3 weeks later...

Hi gang.  No demos to speak of, but I was recently trying to run my recent virtual joysticks experiment... in the babylon.js playground.

 

http://www.babylonjs.com/playground/#1YIAD8

 

I get a non-highlight-able (un-copy-able) and unclosable... Compilation Error - requestAnimationFrame is not defined.

 

The original demo - talked about in this post ... used babylon.js 1.11.0 and hand-1.3.7.js.  It worked.  I switched my local version of that demo... to target the playground's files...

    <script src="http://www.babylonjs.com/hand.minified-1.2.js"></script>    <script src="http://www.babylonjs.com/playground/babylon.js"></script>

And that's when I started getting the error, both locally, and in the playground version (same error in both).

 

See, I was trying to make a "universal project starter file".  Since Deltakosh said that the playground would always use the latest version of babylon.js, I was going to find THAT url and use it in my "starter file".  So I grabbed my virtual joysticks demo, and put those two script elements in it, and tried to run it.

 

It gets deeper than this.  I don't know how others obtain the latest version of babylon.js, but the only way I can find to do it... is to use that 'download zip' link in the bottom right corner of github, and download the entire repository, and then extract the babylon.js from that big zip. I cannot find a way on github... to download ONLY the babylon.js file.  So, instead of always having to do that extract-from-zip whenever I want to start a project using THE LATEST BJS, I was going to make my starter.htm... target the playground's BJS and hand files, and that way I know I am using the latest version(s).

 

Maybe I am missing some button at github... to choose "download THIS SINGLE file".  :)  The RAW button is about as close to a "download this file" as I can get to a "downoad this".  What a newbie, huh?  Maybe I should read the github docs... and learn how it works, huh?  Or maybe this is how everyone gets the latest babylon.js.

 

All that incompetency aside, there MIGHT be a problem with virtual joysticks in the latest version of babylon.js... having something to do with requestAnimationFrame.  And if anyone wants to teach me how to download the latest version of BJS from github, without having to download a zip of the entire repository, that would be very handy.  Thanks!  Party on!

Link to comment
Share on other sites

Maybe I am missing some button at github... to choose "download THIS SINGLE file".  :)  The RAW button is about as close to a "download this file" as I can get to a "downoad this".  What a newbie, huh?  Maybe I should read the github docs... and learn how it works, huh?  Or maybe this is how everyone gets the latest babylon.js.

 

That must be the way to do it indeed. You can use TortoiseGit also (instead of TortoiseSVN).

 

If you are on Windows, you can use https://github.com/BabylonJS/Babylon.js/tree/master/Tools/BuildOurOwnBabylonJS, read the "How to use it" category. Otherwise, there is https://github.com/BabylonJS/Babylon.js/tree/master/Tools/Gulp. Both will help you to "build" the minified version of babylon.js with the latest code (from separate files that you get by cloning/fetching the github repo) plus your modifications.

Link to comment
Share on other sites

  • 3 weeks later...

Hi gang!  Its been a long time since I posted in this thread, but I am back to announce the latest version of my project-from-hell flyer... and the zipped version, too.

 

Nothing new with the look of the flyer... its still just a 'frame' that can be stripped-down and have spaceship models parented to it. But finally, after much toil and many beggings to Deltakosh for help... it is flying perfectly.  Its throttles are a little powerful at the moment, but do I care about THAT trivial thing?  Hell no.  It flies correctly, inverted or not.  The correct thrusters turn-on, inverted or not.  The 12 rotation and position functions near the top of this ugly file... became my personal hell for over 6 months!

 

A little ways down, you'll see a function called...

 

BABYLON.FlyerFrameController.prototype.doTransformPerFlyerQuat()

 

That was given to me by Deltakosh, recently, and it completely saved the project, both for my 6 translation functions, and for my 6 rotation functions.

 

It feels SO SO good... to finally have the flyer acting aeronautically correct.  (Thanks again, Deltakosh, and BabylonJS!)

 

If you are crazy enough to examine the HTML, you'll see two interesting calls...

 

// instantiate a flyerframe
var flyfr = new BABYLON.FlyerFrame ("ff1", framewidth, frameheight, framedepth, tubingsize, sm1, scene, true);

 

and

 

// instantiate a flyerframe controller

var ffc = new BABYLON.FlyerFrameController ("ffc1", flyfr, "wasd", {}, scene, true);

 

That's right, kids.  The flyer is ready to be a BABYLON 'primitive' meaning that anyone can easily 'instantiate' one or many... for their own use.  Just two commands, and you have a fully physics-active, applyImpulse-thrusted spacecraft 'frame' that you can parent your spacecraft models-to.

 

None of that is fleshed-out yet, but I hope to do it someday soon, and I also hope to have it included in some version of the framework or maybe in the GameFX library.  There's only two JS files... the controller file mentioned above, and the fully size-settable flyerframe model. Ok, and a few textures and jQuery for the keypresses.  :)  (shifted numpad and control numpad OR shifted o k l ; . pgup pgdn and control o k l ; . pgup pgdn).  Yep, lots of active keypresses if you don't want to use the buttons... and whether you have a numeric keypad or not.  We got ya covered.  :)  Remember that you can hold-down those buttons and keypresses for as long as you wish... for continuous thrust.

 

Did you know that there are 4 particleSystems active on EACH thruster port?  Did you care?  :)  One for fire, one for smoke, one for soot, and one for the hell of it.  You can adjust the particle textures and adjust the emitter properties on all of it.  FUN!  I have been too lazy to get those properly textured for fire, smoke, and soot, yet.  24 thruster ports = 96 particleSystems.  Holy crap, huh?  Be glad that only 16 are emitting at any given time.  :)

 

It sure feels good to have it flying correctly!  And it only cost me 2300 grey hairs and 62 wrinkles!  So take the flyer out for a spin. Please report any flight dynamics bugs you might see.  I will probably produce a demo with a skybox, some ground, and a chase camera... before the end of the summer.  Or, feel free to do it FOR me, ok?  ;)

 

This device and all of its code... is free to use by anyone.  You can even say that YOU coded it... I don't care whatsoever.  PARTY ON!

Link to comment
Share on other sites

Hi gang.   Here's flyer 26 and its zip file.  Nothing all that different. 

 

The invisible collision box (which is also the flyer's parent and point of applyImpulsings)... is the same size as the whole flyer now, so it acts better when you bounce off the physics walls.  Two landing pads installed which you must thrust against... to stay landed on them, because there is no gravity and no magnetic landing gear, yet. 

 

Larger area to play within.  Two new buttons... 'stop flyer' and 'orient flyer' to help recover from out-of-control spins and other flight problems. If text overflows, try your control-mousewheel to size it.  Toggle between free cam and arcRotate chase cam... with 'C' or by pressing the 'C' button. 

 

Same thrust controls as mentioned in the last post. Generally speaking, SHIFT numpad for translations (positions), CONTROL numpad for rotations.  Got no numpad?  Use  shift and control  o k l ; . pageUP and pageDOWN keys.  Hold-down buttons for continuous thrust.  Goof around, you'll figure it out.  :)

 

Note:  All flyers prior to this one, had reversed Z-rotation.  Quite pathetic of me... confusing +Z rotation and -Z rotation directions.  NEWBIE!  IDIOT!  Sad.  Controller08.js fixes it... in this version of the flyer.

 

Have fun.

Link to comment
Share on other sites

  • 2 weeks later...

Hi girls!

   Well, it has been some time since I made a goofy demo for The Wingnut Chronicles, so, here we go!  This time, it is a playground demo.  Fun!  Use the playground's Get .zip button and take it home, if you want.

 

This also might be the largest playground demo to date!  (But maybe not.)  This demo might be linked-to in the Playpen Series tutorials someday.  It is 'an extreme newbie helper scene'.  :)  I had a total blast (fun time) making this thing.  I always enjoy coding Babylon.js scenes.

 

By the way, the playground has its very own big fat tutorial, now, too... but, maybe I should announce that in the 'Tutorial Talk' thread.

 

Hey, I hope everyone is well!  PARTY ON!

 

PS: Hey Davrous, God of the Virtual Joystick.  If you read this... I have a challenge for you, should you decide to accept it.  Do you think you could make a tiny 2D compass with 4 directions on it... +Z, +X, -Z, -X... that always shows which direction the activeCamera is looking?  I'd like to see one... placed below the FPS readout in the playground.  But it would be handy for the general BJS community, too.  Difficult?  I bet so.  Are you up to the challenge?  I'll do your laundry for a month if you can pull it off.  ;)

Link to comment
Share on other sites

ANY topics are welcomed here, fluff... have fun. 

 

In your comment, are you speaking-of the scene.textureContext.font = "bold 30pt Arial"; ?  hehe.  *nod*. 

 

It 'feels' like html, but it's not.  To be honest, I wish we COULD use a dom node as 2D text in 3D scenes.  How are we supposed to go browsing in our 3D dungeons without having a browser available on the side of a box?  :)

 

Box model on a box model.  ar ar ar.

 

Unfortunately, we need to use one of these canvas-text contraptions... https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D .  Hell, I can barely READ that, speak nothing of driving it.  :)

 

BabylonJS's DynamicTexture Class has a .drawText method that was designed to ease the pain a bit, but Dad72 showed me a .getContext, and I get better text-placement power with that, as opposed to the .drawText method.  On another project, .drawText worked excellent for me.  Learning learning learning. 

 

FYI everyone... there is no scene.textureContext by default.  It is a dangerous Wingnut scene object overload (a personal storage compartment) that I use for this project only.

Link to comment
Share on other sites

Hi gang!  First, I would like to say THANKS to fluffrabbit... for your comments and enthusiasm.  You are seriously knowledgeable, interesting, and entertaining.  I love reading your comments, though they sometimes go over my head... due to my lack of experience.  But don't let that slow you down. :)

 

For those who are not familiar with The Wingnut Chronicles, it is a place to talk about anything.  The subjects change often, and this is sometimes a staging area used to determine if a topic is worth having its own thread in the forum.  At other times, this thread is for Wingnut to yap about the things he is doing, and thinking about.  THIS post... is just that.

 

Recently, I was given permission to write Basic Series tutorial #0.  The purpose of BS-0 is to tell beginner users of BJS topics that I think they would like to know.  Things that aren't really BJS framework things DIRECTLY, but are more SUPPORT things for the framework. 

 

(Hey github 'pages' experts... do you know how to remove the width-stealing PAGES menu from the right side?  PLEASE tell us how... so we can get full screen width for our tutorials!  Meanwhile, control-mousewheel might widen it out.)

 

I have found that when writing tutorials, "a picture is worth a thousand words".  The demo that I presented a few posts ago ( http://www.babylonjs.com/playground/#1DBXNA ) is an early attempt to introduce new users... to POSITION and ROTATION, and to help them understand the axis orientation of a BJS scene. 

 

That scene seems too 'busy'.  But I figured that... ff a picture is worth a thousand words, then a 'movie' made from a BJS scene... is worth 100,000 words, right?  :)

 

During my touring of the ActionManager documentation, I thought about interpolation... or more specific, BABYLON.InterpolateValueAction action.  What a sweet action interpolator this is.  In my tutorial-from-helI (BS-0), I want to introduce new users to Vector3's and Color3's, which are heavily-used in a BJS scene.  They are not currently taught anywhere in our documentation, and can be confusing for new users. 

 

The BJS scene-based 'movie' that I dream-of...  will likely look something like this:  http://www.babylonjs.com/playground/#1W0THV .  When animated into a 'movie', the box will go through a sequence of position changes, rotation changes, and color changes... with all the values being displayed on the red text plane, in real time (live-updated).  But I have other ideas, too.

 

One of the things I thought about... is using BABYLON.InterpolateValueAction as a stand-alone thing.  Keyframe animation has the power to interpolate values, too, but... wouldn't it be sweet to KEEP my switch/case 'event sequencer', yet use a BABYLON.InterpolateValueAction device inside each CASE?  I would be using the interpolator... as a 'use it anywhere' device.  This may be already possible... I have not researched it at all.

 

InterpolateValueAction(trigger, target, propertyPath, value, duration, condition, stopOtherAnimations)

 

One thing that could stand in the way... is the 'trigger' parameter.  Let's look at an ActionManager 'registerAction' call...

 

mesh.actionManager.registerAction(new BABYLON.InterpolateValueAction(BABYLON.ActionManager.OnPickTrigger, light, "diffuse", BABYLON.Color3.Black(), 1000))

 

What if...  the 'trigger' parameter was removed from the BABYLON.InterpolateValueAction?  Would it become a more portable object?  What if the trigger... was the first argument of the .registerAction call?  Like this...

 

mesh.actionManager.registerAction(BABYLON.ActionManager.OnPickTrigger, new BABYLON.InterpolateValueAction(light, "diffuse", BABYLON.Color3.Black(), 1000))

 

Does this change... allow the BABYLON.InterpolateValueAction() to be a more portable object, and easily something I could put into each CASE of my switch/case animation sequencer?  I don't know.  There could be issues preventing this change.  It seems to me... that removing the trigger parameter from BABYLON.InterpolateValueAction ... would make it a portable interpolator.  It could be used in many ways, and not just as an ActionManager action object. 

 

Maybe this is already possible, but we would still need to PROCESS the interpolator somehow, and I think the processor is located on the ActionManager and nowhere else.  Here is my code thoughts:

switch(box.animation_phase) {     case 1:        var r = new BABYLON.InterpolateValueAction(box, "position", BABYLON.Vector3(0,0,17), 1000).execute();        box.animation_phase++;        break;     case 2:        var r = new BABYLON.InterpolateValueAction(box, "position", BABYLON.Vector3(0,0,-17), 1000).execute();        box.animation_phase++;        break;}etc. etc.

Above code was recently edited after re-reading this thread!  Actions have an .execute() function!  COOL!

 

This is non-runnable code, of course. There is another problem here, too.  Since this switch/case is being run once per frame, box.animation_phase is being incremented before the previous interpolator has time to finish its action.  We would need to somehow wait for the first interpolator to finish, before moving to the next animation phase. At first, I thought the actionManager's .then was used as a "wait until done" thing, but under closer examination, it seems more like a first click, second click, third click thing.  I'm still reading and experimenting. :)

 

How about an onSceneReady or maybe onRenderingStart trigger?  :/

 

*shrug*.  These are just some thoughts that I have been thinking, lately.  I will probably be testing an ActionManager with a long list of .then's... sometime soon.  I don't know which way will become the better 'movie maker' way... the actionManager or the switch/case... but, I KNOW that I will have fun testing both ways.  I always have fun using Babylon.js.  PARTY ON!

Link to comment
Share on other sites

I agree that removing the trigger from the action itself is a good idea.  Could be manager.register(trigger, action).  Am starting to look at embedding and possibly sub-classing ActionManager for a deformation/shape-key mesh sub-class called "Automaton".  Tower of Babel would sub-class "Automaton" for meshes with shape-keys.

 

You could then sub-class the TOB class to make/register all your actions.  I am kind of put off by just "playing some kind of static video" that bone animation has. 

 

Gryff's talking face can only say "To be or not to be, that is the question", if I remember.  Making a "video" of that is of little use.  If maybe 16 or so "deformation chains" for syllables could be made in the TOB class, sub-class, then maybe it could actually mouth anything on the fly.

 

Also, can there be user defined triggers?  They just a number right? 

Link to comment
Share on other sites

Ok, looks like I am not going to use ActionManager.  I want a queue mechanism for each shape-key group (think hand, legs, mouth) that can be initiated from the outside, on demand.  This could be a queue of BABYLON.Actions though.  These queues would be consulted every frame, which is blocked in ActionManager except for Scene.

 

On a completely, different aspect.  Has anyone thought of doing a play audio action?

Link to comment
Share on other sites

If maybe 16 or so "deformation chains" for syllables could be made in the TOB class, sub-class, then maybe it could actually mouth anything on the fly.

 

Jeff, that would be nice - just like this maybe:

 

Speech Character

 

Though the voice delivery is hardly Helen Mirren, Judi Dench or Kenneth Branagh

 

You probably would only need 10 phonemes, the text parsing and the speech synthesis would be the tricky part for me - obviously doable but may be beyond my coding ability.

 

My little example was built with three shape keys mouth open, upper lip, mouth narrow - which were mixed in different amounts together to form those 10 phonemes.

 

I spent a little bit of time watching various professional actors/actresses deliver lines - and there seems to be another issue. The phonemes seem to be nice theoretical shapes but they may not be followed in practice. As a generalization It seemed to me that male actors move the upper lip less than female ones., and the volume of the delivery seems to have an impact. But that I suppose is being a little picky :o

 

cheers, gryff :)

Link to comment
Share on other sites

BJS ActionManager is still evolving.  It is getting cooler and cooler by the day, in my opinion.

 

Wingy, I keep thinking I should spend some time trying it out - but I keep putting it off. Procrastinating you say ? :o

 

But I do like Switch/case statements.

 

cheers, gryff :)

Link to comment
Share on other sites

:)  Yeah, I was kind of hoping for a system where (in pseudo)...

 

   onSceneIsRenderingTrigger...

      interpolator action1.execute().  When done...

      do nothing for duration xxxx.  When done...

      interpolator action2.execute().  When done...

      do nothing for duration xxxx.  When done...

      interpolator action3.execute().  When done...

         etc.

 

It doesn't appear to be possible, by default.  I don't think that is the purpose of the ActionManager.  But a guy can always "jury rig" a Babylon ACTION base class and make it do what he wants it to do.  In other words, borrow the action object code, use the interpolation part... as is, but when finished, start the next delayer or interpolator in the container/array. 

 

That's what's cool about JS.  Just modify things until they work for your project.  And, just maybe, animation objects can do what I want.  I haven't studied them much.  Anyway, none of this applies to you God-like Blender export experts... sorry.  Hope everyone's well.

Link to comment
Share on other sites

But a guy can always "jury rig" a Babylon ACTION base class and make it do what he wants it to do.

 

LOL Wingy. Sometimes, something that people write triggers me - and I end up going off in all kinds of directions ;)

 

"jury rigged" - has to do with sailing ships - but I was brought up with "jerry-rigged" and "jerry built" which is likely to be linked to the Jerry brothers - cheap builders in Liverpool in the 1830s.

 

But "jury rigged" .- has to do with sailing ships - as does "parish rigged" which triggered in my mind a song - a pump shanty allegedly from ships traveling from US West Coast to Liverpool (again)

 

So here is made up verse that might go with that shanty:

 

The script won't run, nor stay, nor wear,

Leave her, Wingy, Leave her!

An' so us scripters learnt to swear.

An it's time for us to leave her!

 

Be careful what you write Wingy - my mind can wander  ;)

 

cheers, gryff :)

Link to comment
Share on other sites

haha.  You have a connection to skunk bud, don't ya?  Your kids are bringing it home from the colleges, aren't they?  Lucky dog!  :)

 

Alas, before I learned of your research on that term, I thought it was about a corrupt courtroom jury.  But you are correct... it speaks of a "jury mast"... a makeshift mast raised when the main mast has been lost.  Interesting! 

 

And thanks for the shanty.  Now, what do we do with a drunken scripter, early in the morning?

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...