PG: Catch Spheres with a DragBox

Hi all!

I made a playground, where you can catch spheres with a dragBox!

I saw a lot of questions about converting screen XY to world coordinates.
So I share this PG here!
Hope it helps! :smiley:

https://playground.babylonjs.com/#2SA7J8#4

5 Likes

@PirateJC not sure where but this could be a nice Doc topic ?

@ynnek this is fantastic!

I’d love to add this into the documentation. One quick favor to ask. Would it be possible for you to add some comments in the code to help explain what the different parts are doing? That way when people go through the code they have some guidance on what each section in the playground does? That would be super helpful, and then I can add the playground into the documentation.

Thanks in advance for the help!

1 Like

@PirateJC Of course!
I will add some comments in the PG and share soon :smiley:

Hi, @PirateJC !
I added comments in PG below :smiley:

https://playground.babylonjs.com/#2SA7J8#6

2 Likes

AWESOME!!! Thank you so much!

I’ll add this to the documentation today!

1 Like

Should be live in a few minutes

3 Likes

Thanks @PirateJC!
I checked my PG was added to the document!
It’s so meaningful to me!

By the way, although in a new tap the PG works well, I found it doesn’t work inline at the documentation page with the error message below :cry:

Cannot set properties of null(setting 'style')

I think this is because the div with id _dragBox didn’t created.
Is it because the document site doesn’t allow someone to handle html element or something?

Adding @RaananW for some guidance on this question.

1 Like

The HTML structure in the full example page is a little different than the one in the playground. I’ll fix that later today. Thanks for letting us know!
I’ll fix the playground to work all over :slight_smile: we can’t change the html structure

1 Like

Issue was resolved, a new PG will be populated in a few minutes. thanks again!

1 Like

It works well now!
Thanks @RaananW @PirateJC :smiley:

2 Likes