Is it possible to implement lasers in a game to shoot objects using raycasting and reflection (to reflect the lasers)? Thank you.
Essentially, yes - but remember that “raycasting” is a technical term for a mathematical process used within the physics engine and not a visual representation of anything.
Could you please clarify what you mean by ‘not a visual representation of anything’? Also could you point me out on an approach to create laser like effects (if not by using ray casting)?
Hello @firdausm,
Please check out the tutorial/demo linked below. It shows you basically everything you describe: raycasting, reflection, and how to “visualize” those lasers based on the internal physics-based raycasting. What @horacebury means with “not a visual representation of anything” is that raycasting merely checks for collisions along a path (ray) in the physics engine, but it does not automatically display any visual object based on the ray… that must be done separately.
http://www.coronalabs.com/blog/2013/05/07/physics-raycasting-and-reflection/
Best regards,
Brent
Hi Brent, thanks for the clarification. I’ll post again if I have any questions in regards to this.
Essentially, yes - but remember that “raycasting” is a technical term for a mathematical process used within the physics engine and not a visual representation of anything.
Could you please clarify what you mean by ‘not a visual representation of anything’? Also could you point me out on an approach to create laser like effects (if not by using ray casting)?
Hello @firdausm,
Please check out the tutorial/demo linked below. It shows you basically everything you describe: raycasting, reflection, and how to “visualize” those lasers based on the internal physics-based raycasting. What @horacebury means with “not a visual representation of anything” is that raycasting merely checks for collisions along a path (ray) in the physics engine, but it does not automatically display any visual object based on the ray… that must be done separately.
http://www.coronalabs.com/blog/2013/05/07/physics-raycasting-and-reflection/
Best regards,
Brent
Hi Brent, thanks for the clarification. I’ll post again if I have any questions in regards to this.