Quick question here - is there a way to move a bullet inside onBeforeRenderObservable very quickly through the scene without it skipping meshes it should intersect with?
Right now i move the bullet by 10 units, but obviously if something is smaller than 10 units, there is a high chance the bullet will just jump behind it and the intersection wont be detected.
I was thinking that each bullet could have a ray and check 10 points in front of it, if there is a mesh, then adjust properly, but I am afraid that is going to be performance heavy.
Click screen to fire. Goofy, huh? Likely somewhat limited, but, what the heck… gets us thinkin’, maybe. We should be able to shove nearly anything into the boxes array, and if the bullet comes-within 1 unit of it, it will execute target/box.impactAction(). Then impactAction executes target/box.resetTimer(). Then resetTimer executes target/box.resetAction(). What a mess, but sort-of fun.
I have no idea if I am on-topic, though. I was scared during the whole time I was coding it. heh. Using that Distance() thing… is sort-of like “Working without an ActionManager”.
I always love how you think outside of the box wing
But… (there’s the but)… try setting the bullet speed to 2 in your scenario. None of the boxes will light up, because the bullet “jumps over” them.
Anyway, I think I fixed it yesterday with the ray cast for each bullet, it seems like the cleanest solution with the least code.