# solved Bounding Pyramid - The Chamfer Challenge

## Recommended Posts

Hi kids!  Wow, Wingnut's 2nd Q&A thread-starter IN A SINGLE DAY!

Okay, I got this playground thing... https://www.babylonjs-playground.com/#BFM7EX#9

It started as @adam's demo... making a bounding box from an empty mesh.

Tilt the camera up/down... notice that the standard bounding box LINES... can be seen THROUGH the ground, and THROUGH the pyramid, too.  I need that to remain the same.  This is NOT TRUE with the yellow linesMesh.  They cannot be seen thru mesh.

Solve Option #1:  Using the boundingbox.vectors or .vectorsWorld crap in lines 49-59, I would like to "taper" the top of the bounding box... so that it matches the pyramid contours/angles.  In other words, CAN the boundingbox.vectors be adjusted... so that they match the yellow linesMesh lines?  In lines 52/53, I make position adjustments to the vectors, but I can't get the bb to update (in lines 58/59).

Solve Option #2:  Can someone/anyone make the yellow linesMesh... ACT-LIKE the boundingBox lines?  (Make yellow lines be seen THRU mesh... in some/any color.)

I am working on a physics "applyImpulse location/direction indicator/icon".  (huh?)

This little pyramid arrow... shows users the impulsingObjects that they have created earlier.  This is part of a system that can be used to put MANY pre-made points-of-impulsing into a physics scene - great for testing angle constraints and limitMotors, etc.  Ideally, the pyramid arrows are clickable, too... firing the impulse that is associated-with/bound-to THAT particular "impulsing arrow".

Often, the applyImpulse contact point... happens at mesh.getAbsolutePosition()... which is INSIDE-of the mesh.  I would like my 4-sided pyramid "impulsing arrow" to be seen by users... even when it is inside-of a mesh.  RARELY are impulse contact points set to apply force on/at the outer surfaces of a mesh/impostor.  Almost always... the contact point is somewhere inside the mesh volume.

I prefer NOT NEEDING-TO make the physics mesh semi-transparent.  This is going to be a physics helper - part of a physics "impulse builder", so it needs to work on ANY physics-active mesh... no matter the transparency.

In this version, we can see that lines from BABYLON.BoundingBoxRenderer are visible, even when "within" full-alpha mesh volumes.  I just need it to be an arrow, not a box.

Ideas/help greatly welcomed and appreciated!  Party on!

##### Share on other sites

Hi Wingnut... good to see you again.

You could always "assemble" an arrowhead that can be seen inside of other mesh.  It takes 5 mesh, or 5 of Adam's blank-mesh bounding boxes... to make it happen, though.  hmm.

And the arrow is not the most "see-able" thing... under certain color conditions.  hmm 2.0   When mesh final color is Color3(.28, .28, .28), arrow is GONE!  OH NO!

(That color is dependent upon lighting and other multiplied-into-diffuseColor factors.)

I've never ever ever "hacked" BJS engine.js/ts... but... I suppose there's a time and a (dangerous) place for everything.    I think Engineville is where they produce those bounding lines... created by a mad scientist... in a secret laboratory.   I'm scared.  :/

##### Share on other sites

I think it's few more versions from an Eiffel Tower building with animations!  Very cool Wingnut.  I'll join in here, so you're not talking to yourself   Don't know exactly what you're looking for help on, though...

##### Share on other sites

I'm looking-at various ways to make an arrow-head... be visible.... when inside-of a non-transparent mesh.  (in a nutshell)

Later, it will be clickable (if possible), and cause an applyImpulse to happen on a physics impostor... toward the indicated direction and at the indicated contact point.

Does that do it for ya?

Impulse Arrows... Pulsars.  heh  They must be visible inside-of mesh, because that's where MOST applyImpulses... happen... at mesh.getAbsolutePosition();

It would be nice to make a standard bounding box.... pointed... on the top or side or bottom.  Got ideas?  Thx for kind comment... nice of ya.

"Me and my Arrow..."  (song)

##### Share on other sites

What about a nearly opaque hack.. cough and alphaIndex?
https://www.babylonjs-playground.com/#EXT1YT

source:
https://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered#alpha-index

Then just make the nutshell not pickable and you have a pickInfo info to apply impulse?

##### Share on other sites

Wow!  Nice!  I need to study that for a while.

Not sure if plausible for task.

Pretend that's a human spine, upper leg, lower leg, and foot.

Using hinge2joints (which I didn't try, yet)... the hip joint will have 2 axes of pivot/movement.  Hip joints move up/down (x), and also a LITTLE BIT of sideways twist (y).  Knee joint does the same, and so does the ankle.

In this scene, we might need 4 impulsing arrows (pulsars)... per bone/leg-segment.  One to x-hinge up, one to x-hinge down, one to y-twist right, and one to y-twist left.

So, for a fully "impulse-rigged" human leg testing lab... we will need 12 pulsars.   Spine doesn't get any... he's staying static for now.

They could be on the outside of the mesh, on the inside, out in space, any position/direction.  Inside-the-mesh being most-difficult position to retain arrow view.

Nice job, BZ.  THX!  It's worth putting into the box of ideas, for sure.  Not too bad at all.

I would like to allow any pulsar, or gangs of pulsar(s)... to bind-to a keypress or button, too.  So, perhaps pickable is not terribly important.  These are utility items... snap-on tools for physics experimenters.  They need to attach quickly and easily (yeeeeah)

Later versions have a context menu?  Pop-open menu on the arrow... to change forces/magnitudes, contact-points, and display color/size?  Ok, maybe MUCH later.

Pulsars - "Pushing-Bots that YOU can count on!"     I once made an air-cooled racing arrow...[link]... pretty much a waste of verts and vbo glue.  None of MY friends or family will point the darned thing... "too fast".  So, now, it just sits in the garage, aimless, pointless, kind of sad.  It's not a kid's arrow.  It's more of a land speed record-holder arrow.

It takes a special kind of "focus"... to point it (and hold it 'true').    Have insurance, eh?

##### Share on other sites

Before I retire for the night here is an I don't really know what I am talking about answer but somebody who does might be able to turn it into a proper answer answer. Using depth sort make sure the arrow is drawn last on top of everything else.

##### Share on other sites

How about groupRenderingId?  With a holly jolly holiday color theme (no opaque hack - poet and didn't know it).  Oddly enough same source as last post... the docs are getting so good now!!
https://www.babylonjs-playground.com/#EXT1YT#1

##### Share on other sites

Wow, thanks, guys!!!  BZ, you're just a GOD of CSG-wrangling... you make it SO easy... sort of.

Ya made a box, then another, rotated one around 180 degrees, subtracted it from the first, made a triangle.  *sigh*   SOMEDAY I'm going to be THAT CSG-graceful.  (maybe)

I would have plotted it, just like the racing arrow  (apparently I like pain).   I did ONE CSG PG once, and it was SO addictive/fun that I ran like hell, and hid under my fridge.

I think my CSG demo took about a week for me to code.  Smooth, eh?  heh  (Wingy opens Brian's brain, and looks inside to see if he has special CSG cells.)

Thanks again, guys... I think this depth/renderingGroup thing is the answer.  Well done!

##### Share on other sites

Plotting is for pros.  I'm stuck with CSG and not proud of my CSG.  I built a drone (that took a whole day) with CSG and actually almost my entire scene...  unfortunately.   I did eventually discover Blender.

##### Share on other sites

Well ya sure made it look easy.  I am envious.    "Nutshell" was apropos, eh?  Good having you 'pick-up' on that word-fun, BZ.  We rock, eh?

You guys/anyone want to help with a real "noob special"?

There's another demo, using no CSG, but using that cool depth-testing stuff.

ApplyImpulse/applyForce have a vec3 force value in the 2nd param.  That's a direction with magnitude, I suppose.

Does anyone know a nice quick transform line... that would aim my arrow1... in that force direction?  (thx)

update:

Duh, Wingy.  "How To Generate a Rotation from a Target System".  That's it.

Hmm, no it isn't.  But I can smell it.  I'm on its trail.

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.