Dyson Can You Share The Raycast Demo?

Just got around to downloading .844 and eagerly looking forward to implementing Physics instead of manually calculating everything.

I was just wandering when you get a spare 5 mins if you could share any wisdom on the Raycast vid/demos you posted a few days ago. Any info you can offer would be appreciated, I’m currently just struggling to get going with it :slight_smile:

All the best,

The key thing to keep in mind is that the position of sprites and tiles are in relation to groups which are themselves in motion. It’s pretty straightforward after you wrap your head around that. Drawing the results of a raycast onto the screen threw me off for a while because of the coordinate difference. If the origin of your ray is a sprite you can calculate the positions of the hits in relation to the sprite and use Corona’s object:localToContent() function to translate. 

You can download the raycasting line-of-sight demo here: https://docs.google.com/file/d/0B8zoywKO40aiMS1ycVVkaXVYdUk/edit?usp=sharing

Just add your .844 mte.lua to the mte folder and it should be ready to go. The raycasting code is near the bottom of main.lua. 

Hey Dyson - thanks so much, you sir are a legend.

The key thing to keep in mind is that the position of sprites and tiles are in relation to groups which are themselves in motion. It’s pretty straightforward after you wrap your head around that. Drawing the results of a raycast onto the screen threw me off for a while because of the coordinate difference. If the origin of your ray is a sprite you can calculate the positions of the hits in relation to the sprite and use Corona’s object:localToContent() function to translate. 

You can download the raycasting line-of-sight demo here: https://docs.google.com/file/d/0B8zoywKO40aiMS1ycVVkaXVYdUk/edit?usp=sharing

Just add your .844 mte.lua to the mte folder and it should be ready to go. The raycasting code is near the bottom of main.lua. 

Hey Dyson - thanks so much, you sir are a legend.