Jump to content

moveWithCollisions


Lary
 Share

Recommended Posts

We have just 4 options to check:

var world = this.getWorldMatrix();
var worldOrigin = BABYLON.Vector3.TransformCoordinates(ray.origin, world);
var direction = ray.direction.clone();
direction = direction.scale(intersectInfo.distance);
var worldDirection = BABYLON.Vector3.TransformNormal(direction, world);
 
PARTY over! :(
Link to comment
Share on other sites

Well summarized!  Yep, our outlaw is becoming quite worried.  :)

Doe RAY meat (fa-so-la-te-doe)!  Great deer steaks.. from Arte's Point'n'Pick Diner!  "Finger-lickin' point-pickin'... done right!"  heh

Barrel2 is causing intersectInfo from simple mouseOver.  The other barrels, are not.  This is because barrel2 has an actionManager.  Disable it (~ 245-253 in #66 PG), and mouseOver intersect for barrel2... will quit.   #67 PG disables ActionManager on b2, and reports intersectInfo to console.

Link to comment
Share on other sites

That'd be excellent.  Thanks!

 

Update:  https://www.babylonjs-playground.com/#WWCK0#69

These rays look... powerful. :o  They seem to have a pickedPoint at barrel impact, then barrel exit, then ground enter, and ground exit.  Click high enough on the barrel, and our ellipsoidMesh sphere generates even more pickedPoints. 

I think it is being very accurate... as to where/when it impacted a mesh.  I am starting to think that intersects() is working properly, and that forcing pickedPoint.y to be zero (for flat-dragging)... is the wise way to do it (inside getGroundPosition func). 

Drag (and getGroundPosition func) is a particular application of using pickedPoint.  I don't think it is wise to make intersects() be less-accurate, just to satisfy dragging.  I'm beginning to think... that our varying Y... is normal, per what we have asked-of pickedPoint ops.

hmm.  The outlaw may have proven their innocence to me.  Our civil suit... charging intersects() with breaking bug-infestation laws... may get thrown out of court.  We might be seeing "expected behavior"... as diesel-pointing as that thought might be.  :) 

I think it's all good, though.  One hell of an exploration.  Time for a tasty lager.  Perhaps a Foghorn Leghorn cartoon, too.  yeah!

Link to comment
Share on other sites

So, we've commandeered Lary's thread (thx Lary!) pretty severely... let's do it some more.  :)

About these procedural-built spacecraft....

    Because-of performance limits in webGL/JS land, folks tend to model certain things... as a single complex mesh.  Not many separate parts, but plenty of "bumps"... to give it some depth.  But mostly, they use their texture... to paint-on the fine details.  Just 1 or 3 mesh, and some great painting.

BUT... when it comes time to blow that puppy to smithereens... with a bazooka... it's a yawn festival.  About the best "poom" you can do... is some kind of particleSystem explosion, and.. then the big excitement of aircraft.dispose().  There's no pieces to send flying.  Explosion-wise... the model is a flop.  A piece of it can't go flying into a nearby nitro-methane tank and cause any cool extra-explosions.

So... the fun... is in (procedurally/dynamically/with-code) creating REALLY REALLY complex "assemblies" of fun-colored basic primitives (like massive Lego/TinkerToy structures).  Then... POOM!  NOW we got "splode"!!!  [x-splode]   French movie star and god-coder @jerome ... knows about "splode"

"Splode is good, splode is fine, code for splode, have some wine."

I look forward to blowing-up one of your cabinets, someday, Arte.  :)

Lary, whatever it is that YOU are building, I'd be glad to blow that up, too.  My pleasure, totally.  ;)

Link to comment
Share on other sites

On 2017/11/15 at 4:15 AM, Wingnut said:

Lary, whatever it is that YOU are building, I'd be glad to blow that up, too.  My pleasure, totally.

Hi Wingnut, sorry for the late reply. I appreciate a lot that you're still watching my topic.

As an non-English speaker as well as newbie in BJS, I regret to say that your answers seem quite expert and I can only catch some easy points.

I run into a problem again and made a PG for my project, check it out please.

As you see, there are 3 green meshes on the white rectangle, 

each time I move one green mesh and intersect with the others , one or maybe two at the same time, the current moving mesh turns Red, while the meshed being intersected remain green;

when the moving mesh returns to normal position after intersection, its color returns green again.

but it only takes effect when I intersect currentMesh with the second mesh. I don't know why~~

Can you give me some idea please?

Link to comment
Share on other sites

1 minute ago, Arte said:

I have error in console

Peculiar! Did I do wrong when saving the scene? 

I just pasted my code into PG, and click "save" to submit my scene, then it generate a link, i copy it here....

How could this happen....

Link to comment
Share on other sites

There are a lot of unexpected characters in the code you pasted, for example:

"left.position.x -= 100;\\r\\n\\r\\n\\r\\n/**\\r\\n * \u001f\u0010qÜb¶\\r\\n"

Maybe we should have not allowed to save this PG in the first place, but this PG will not work.

Having said that - if anyone else experiences this behavior, it might be on our side and needs to be fixed.  @Lary, can you try again while making sure it runs before you save? the pasted code should have never worked in the first place.

Link to comment
Share on other sites

Hi Lary (and others).  Yep, we have been talking about weird things in your thread.  Hope that's cool.

Lary the playground killer.  :)  Interesting.   @Jaskar once fixed a problem like this, for me... so I will ping/PM him.

I think RaananW is correct.  Illegal char.  Work HAS been done to try to prevent this, according to experts.  Perhaps more work is needed. :)

RaananW, do you have PG DB admin powers, too?

What the heck, I will still contact Jaskar.  Perhaps he is working-on prevention system.

Meantime, Lary, I have un-hidden your post... so Jaskar can see the URL when he visits.  Please keep it visible, for now.  (thx)

Here is a playground that might help with move + intersects.  http://playground.babylonjs.com/#279FW9#33

No moveWithCollisions, there.  Instead, different move method (dragging), and actionManagers with intersectsMesh triggers for collisions.  *shrug*

Link to comment
Share on other sites

Hi folks!

 

There it is, a fresh playground working! https://www.babylonjs-playground.com/#PTG55H

Can you tell me what was this string ? "qÜb¶" in

"left.position.x -= 100;\r\n\r\n\r\n/**\r\n * qÜb¶\r\n */\r\n\r\n\r\n    //200 Ï<20\r\n\r\n    //W‹\r\n    var straight_options"

Some of these where randomly writted in the save. It can help if you remember what you wrote at this place!

 

Thanks, Jaskar.

Link to comment
Share on other sites

Coooooool.  And metadata usage.  xtra-cooool. 

Ya got some collision overshoot... IF mouse velocity is fast... at time of collision.  Seen it before.

Also... if you micro-increase the position.y of picked-mesh when it turns red (or up-scale a tiny bit), then y-fighting jaggies will be gone.  That's fancy coding, though.  :)

How do we prevent collision over-shoot?  I dunno.  :)

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