Bug Issue: Improve Raycast Detection with Terrain

Pages: 1


  • Junior Stencyler
May 16, 2021, 12:37:06 pm
Currently, Stencyl's raycast implementation is only suitable for detecting the distance between actors or single tiles. When attempting to raycast to complex terrain (2+ tiles that are connected to each other), raycasting becomes completely unreliable; sometimes it will travel through tiles, stop at a point between them, or any combination of the two. This is due to how Stencyl groups connected tiles together into a single continuous piece of geometry instead of individual tiles for performance purposes. It was suggested in this thread (http://community.stencyl.com/index.php/topic,61507.msg316725.html) to utilize the slope of the line to get the correct end location of the raycast, but I have been unable to replicate this. At this point it seems more like an issue with the engine itself that should not require this much extra work to calculate.
Essentially, a properly-functioning raycast should look something like this:
  • Raycast line starts at point X1,Y1 and travels to X2, Y2.
  • Creates a list of all objects it came into contact while traveling to that point.
  • For actors and terrain, it returns the X,Y coordinates of the point on the actor/terrain it first made contact with.
Using this extension (http://community.stencyl.com/index.php/topic,16734.0.html) I have been able to do that with actors but not complex terrain because of the aforementioned issue. I believe this is a key issue that should be rectified in the next release to improve raycast collision detections. If you would like any extra details I can provide them.

Pages: 1


  • Reported
    May 16, 2021, 12:37:06 pm
  • Updated
    May 16, 2021, 12:37:06 pm

  • View Status
  • Type
  • Status
  • Priority
  • Version
  • Fixed in
  • Assigned to
  • Category