JLHolmes

OnPickTrigger with ExecuteCodeAction

Recommended Posts

Hey guys... while refactoring some code, I ran off down the path of changing my old picking method (Raycasting, etc) to use actions... specifically OnPickTrigger with ExecuteCodeAction.

But... I was a bit confused when I could not find the picked point on the mesh in the event data. Am I missing something?

Share this post


Link to post
Share on other sites

Hiya JLH!  Good to see you again.

I think this is normal.  ActionEvents don't have a 'picked point'.  I don't know WHY they don't, but they don't.  hmm.

You could put a pick right in the middle of the executeCodeAction handler... but did you gain anything?  It still uses a Ray, I think.

https://www.babylonjs-playground.com/#XG8RH3#11

Line 17... I put a scene.pick inside my onClickyPoo() executeCodeAction handler.  It works... but... hmm.  :)

It didn't remove any raycasting AT ALL.  SO, I was of no help whatsoever, eh?  Yay Wingnut!  heh.  Sorry. 

Possibly, a pickingRay is NEEDED... in order to get a picked point.  Maybe there is no other way.

Stay tuned, others may comment soon.

Share this post


Link to post
Share on other sites

Thanks, Wing... I went ahead and a fell back (ahead? back?) to my old method.

I'm assuming the lack of the picked point is an optimization thing.

The other advantage to scene.pick() is that you can tell when the user doesn't click on something.

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.