Ive just tried the raycasting physics example and it is absolutely perfect for a game concept I’ve been sitting on for nearly a year. I’m sure many developers will be able to use this in future games.
Do you mind if I ask how you’ve utilized this in the game? Somebody was asking me yesterday “what are some use-cases for raycasting?”, and while I can think of a few immediate examples, I’m curious what you’re doing with it.
Only just started working on it earlier, but it involves getting a laser to a goal. This is perfect for being able to draw the laser to the exact point it hits an object.
Can also use the exact contact point to bounce the laser off a mirror etc. Even better it doesn’t require a collision listener, which is great.
One question though.
Say I want to refract the laser light through a prism to bend the laser light. Using raycasting I can get the initial contact point that it hits the prism, so I can also change the angle as it goes through the prism.
But, is it possible to get the hit ended point, so that I can bend the light again as it exits the prism?
I still don’t get it. Any pertinent Google searches on raycasting bring up Wolfenstein 3D. I guess I’ll have to wait until I get home to download the latest daily build to try it out, but if someone can be so kind as to explain its usefulness in game development, especially in regards to physics, I’d appreciate it.
It think the common confusion is “raycasting” as a term in computer graphics versus the physics raycasting that this topic is about. Here’s more info on physics-based raycasting:
As some of you know, I’m building a remake of my space game Archangel, and I had to come up with some (what I thought was) clever thinking on how to detect if a passing asteroid or ship was on a collision course. I set up a separate large “proximity” sensor around the ship which had to follow the ship around. When an asteroid/ship it crosses (collides) with the proximity sensor, I had to determine the trajectories of both the player and the asteroid/ship see if they were crossing (intersecting) each other, allowing for some angular leeway. It was quite a challenge, and it might have taken more CPU cycles than I would have wanted to allocate for it, so perhaps replacing it with this new feature will do it better justice. Thanks!
The “normal” isn’t currently reported, but engineering is fixing that now and it should be exposed for your use in a daily build upcoming. Just keep an eye out.
Like IcySpark says, this would be excellent for an Metal Gear Solid inspired stealth game. Raycasting to create Wolfenstein/Doom uses the technique to calculate how high a wall is based on the distance to the player.
It’s all really great that this functionality is here.
so this would mean, a NPC “raycasts” in a zelda like game my hero, and if there is no intersection point with another object in-between (like tree, unless the tree allows you to shoot through), the NPC will fire at me?