Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to see if there is a clear path between two sprites?  (Read 1301 times)

0 Members and 1 Guest are viewing this topic.

wh1t3crayon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
How to see if there is a clear path between two sprites?
« on: November 18, 2014, 10:49:42 pm »
So let's say I have two objects and a bunch of walls or other obstructions on screen. What would be a way to see if the two objects (sprites, cursor and a sprite, etc) have a clear, unobstructed line of sight to each other (like the line of sight feature in Heroscape if there are any fans out there :P)? I tried extending a sf::FloatRect from one object to the next, and seeing if that collided with any of the wall objects, but you can't rotate floatrect objects so that won't work. Any other ideas?

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog

wh1t3crayon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: How to see if there is a clear path between two sprites?
« Reply #2 on: November 19, 2014, 12:51:35 am »
So going off the ray casting implementation, I would use an sf::VertexArray to assemble all the different triangles?