How to move stair up and down using control buttons

@Necips but how to create objects in different position, and if yes does this will affect the performance of my interface because there is a lot of meshes inside

When I load my scene I can identify the meshes by there ID and then the magic happens: I can modify anything with the single meshes.

      Promise.all([
        
        BABYLON.SceneLoader.ImportMeshAsync(null, "scenes/", "Cub3_Plane_v06.obj", scene).then(function (result) {              
          bPlaneLoaded = true;
          for(var i=0;i<result.meshes.length;i++) {                            
            result.meshes[i].position.x = 0;
            result.meshes[i].position.y = 0;
            result.meshes[i].parent = meshes_hinges[1];
          }

        }),
      ]);

@Necips yes but here inside your Cub3_Plane_v06.obj there is a lot of meshes that u want to annimate via your loop, not the case of me I have one stair object and not a lot of stair-steps meshes

@Anes
Can you not separate the stairs in sketchup before exporting ?

That would be the simplest.
Other option could be to do it in babylon, this is slightly more complicated and has to be done each time it is loaded… (at cpu / loading time cost)

@aWeirdo I have it in SketchUp and I can export it to blender, do you mean seperate the stair into step-stair meshes ?

Yes, just a single step and the two platforms(at bottom and top of stairs) as others also mentioned, delete the rest of the steps, then re-make them with instances within babylon

Okey, I’ll try it

1 Like

Hi again, A. #1 would be many clones/instances of a single stair… all positioned in a way to appear much like your current stairs (like aWeirdo mentions, too). I got the extruder instancing working… dumb wingnut mistake in positioning them. https://www.babylonjs-playground.com/#165IV6#822 I may try some animating… soon.

Heya Necips. Are you going to build one of those (200 physics joints?) motor-driven chains… for us, seeing it’s “quite simple”? :wink: Sprockets on the primary motor drive and secondary pulley? Each chain link able to accept a sprocket tooth INSIDE it, and moved-along by the teeth? Yeah, I’d love to have one of those physics engine demos… for all sorts of future projects, especially physics-driven bicycles and other vehicles. Make one for us… full powered… and you’d be fizzix-famous. I have never seen a physics-active chain’n’sprockets demo, anywhere, so far.

@Wingnut, what would you pay me?
I’m not an artist - I can’t live from applause alone…
and I’d like a motivation to work for you. :slight_smile:

1 Like

What about the FAME? That’s what pays the bills, no? Do it for posterity. Do it for mankind… for world sprockets/chain peace… for the little woodland critters… for the noobs, for the babes, for the hell of it. :smiley:

1 Like

Hey @Anes - a starter kit… https://playground.babylonjs.com/#KI8BJH#5

Currently, shape and path aren’t set perfect… so slope-angle and stair-size is not very accurate. BUT… we got UP and DOWN buttons doing a small up/down animation movement on the gray staircase (just a little… for each button press). Might have problems in my vector3’s for lines 139 & 145, too. That issue is possibly improved in PG #6.

Also, ease is disabled in moveTo() func. Just add ease as the last param in line 69… to-re-activate it, as wanted.

Plus, I have no “loop-around” happening. When top step gets too high, or bottom step gets too low… we have to move it to opposite end of staircase. :slight_smile: Fun. Plenty of tweaking needed… but… I think you can see the possibilities, there.

Do you want to “run with it” from here? Do you want some explanation of the playground, so far? Maybe other forum helpers will want to advance this a bit, now that I have started it. The moveTo() animation-helper function might need tweaking. It might need to change from a “moveTo” to a “move”, or maybe it needs replacing, possibly with moveUpAndCheckWrap() and moveDownAndCheckWrap().

Good fun, BJS-style.

omni engine is … &%/(zensored)$§!!!

I took my turtles and created by accident a tank chain! :smiley: … which can be used as a starways too.
https://www.babylonjs-playground.com/#3MR41H

The rotation algorithm should be optimized by suitable fourier serie

Some suggestions for architects:

  1. example:
    https://www.babylonjs-playground.com/#3MR41H#1

  2. example:
    https://www.babylonjs-playground.com/#3MR41H#2

  3. example
    https://www.babylonjs-playground.com/#3MR41H#3

@aWeirdo I think that ur proposition has been done by @Wingnut here https://playground.babylonjs.com/#KI8BJH#5 (thank you @Wingnut by the way :innocent: ) the problem is on the animation of the stairs, I want to move them the same way of a real metro station escalator (not up down), I don’t know I have an idea and I don’t find a way to implement it, the idea is :

  • If I click to move up : the top-stair-step will move and take place of bottom-stair-step and the bottom-stair-sep will move to first-stair-step, the first-stair-step will move to secons-stair-step ans so on.
  • but when moving the top-stair-step to to bottom it happen invisible (we don’t see the mouvement of the step-sair like it is hidden by escelator chain )
1 Like

similar to @Necips first example:

https://www.babylonjs-playground.com/#WXQ2S4

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

2 Likes

@Wingnut @aWeirdo I tried this https://playground.babylonjs.com/#KI8BJH#8 so when I click move up it moves once, I need to

  • hide the movement of the top-step to the buttom
  • and repeat the scene

Hi Anes and all helpers. Ya know, I think @adam’s and @Necips’ escalator looks pretty good (they’re both geniuses, ya know?)

So… I merged their code into your scene, added a (bad Wingnut-coded…) direction-adjusting system, and hooked up the GUI buttons.

https://playground.babylonjs.com/#KI8BJH#10

It still needs rotating and size-adjusting, and, to be frank, I have no idea how to do that (to that gorgeous sinusoidal escalator formula of Adam’s/Necip’s). We might need to rotate entire main model.

Scary stuff, but, damn… these guys are as smart as they come, eh? Math Gods. (sigh, drool, envy, etc). Thanks for the assistance, guys! Well done!

And Anes… you are/were advancing real well… in your previous playgrounds. I can see your deductive reasoning and brave experimenting at-work… and you are surely headed towards becoming a BJS pro. But this algorithm/formula… is/was semi-complex, so we should probably TRY to use what the guys have built for us, somehow. You gotta admit, it looks pretty darned nice.

I lead you astray with the moveTo function. We needed a better animator than that, one with an onAnimationEnd callback function… so you could hide the end-around stair-step during the long-move, and NOT use moveTo for that move. Instead, set its .visibility=0 and then make it JUMP to the other end… with a quick step.position = someVector3. Possibly, a real HIGH SPEED moveTo would work, but still, our moveTo has no onAnimationEnd… and we needed that… for the “hiding”.

There were other logjams, too… because… I was hurrying and hadn’t let smarter people than I… reply. Sorry about that. And again… you were/are doing a great job with BJS so far… but your project is a “big gulp”… complexity-wise.

Perhaps… we can beg Adam/Necips/others… to help us “apply it” to your mostly-disabled main model. (fingers crossed) :slight_smile:

@Wingnut @aWeirdo so I will thank @adam and @Necips, so I hide my stair and replae it by step generator here the PG https://playground.babylonjs.com/#KI8BJH#15.

but when I test it using my stair (I devide it into sumeshes in blender), and I want to use the same algo presented by @Necips here the PG https://playground.babylonjs.com/#KI8BJH#16
is looking so big comparing with my stair mesh :thinking:

https://playground.babylonjs.com/#KI8BJH#19

I changed your ‘y’ variable… to be named root. You should avoid naming a variable x, y, or z… when swimming in 3d waters. :slight_smile: Might be wise to avoid u, v, w, too… which is same as x,y,z, but for textures.

In lines 34-37… root needed some fresh scaling, rotation, and positioning. In BJS… parenting is sort-of the same as grouping. Mesh-parents… pass-along their scaling, rotation, and position… to their children (group members), which can ADD/SUM their own values… to/with the handed-down parent-values.

All in all, we can rotate, scale, position the topmost parent (group), and all the members of the model… go along. YAY!

Ignore lines 38/39… Wingnut trying something and failing. :slight_smile: I was trying to get the master model to… “reset yourself back to 0,0,0 rotation and position values, and 1,1,1 scaling values”. Sort of a “naturalize” this mesh at current rotation, position, and scaling, yet don’t visually change ANYTHING… attempt.

That “bake” would likely work… but… I think your “root” node… is SOME distance from the top, bottom or center… of the e-stairs. There is a rather wide space-gap. It can be fixed in JS or modeler, I suspect. Meantime, no baking, yet. :slight_smile: Updated to pg#19… a little “cleaner” PG, but same functionality.

Looks like the sine wave needs a little increase in peak-to-peak AC voltage. A little more audio amplitude (volume) for that tone. :slight_smile:

1 Like

@Wingnut thank u so much dud for ur effort now the escelator works fine (I should remove my stairs and replace them with BJS step meshes and then ajust the position and the rotation to have a nice stair :smile: ).
don’t worry there is only problems I’ll show you my metro station soon (with problems of course :smiley: )
we learn from you guys, thank you so much again
peace :v:

1 Like