Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4596068
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:03:46+00:00 2026-05-21T23:03:46+00:00

Examples of what i’m going to need: I’m using cocos2d to draw a CCTMXTiledMap,

  • 0

Examples of what i’m going to need:
enter image description here
enter image description here

I’m using cocos2d to draw a CCTMXTiledMap, on those tiles i’ll have to draw the LOS triangle.

How would i test if the player is within that triangle, taking obstacles into account?
How would i draw the line of sight area like in the examples above?

BTW, i wasn’t sure if this should have been posted here or on gamedev, don’t be mad.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T23:03:47+00:00Added an answer on May 21, 2026 at 11:03 pm

    You may wish to look at point-in-polygon algorithms such as the ray casting algorithm described here.

    You can break up the triangle to account for obstacles, or just make a more complex polygon. You should be able to find an implementation to suit your needs online.

    You may also want to take a look at this article for some inspiration. You can maintain a tree like structure, a root triangle (or fulcrum) that can be used to determine whether a point is in general line of sight, with the children (triangles) taking obstacles into account. That way you can quickly eliminate more complex checks.

    In the image below the dark blue dots are quickly eliminated from further checking as they do not fall within the root viewing triangle.

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The examples I have seen are geared towards C#. Any tips would be appreciated.
Tried examples from 'php.net' but don't understand what's the problem. Any suggestions? <?php $_SESSION['test']
I have found numerous examples on uploading a file to a web server via
Examples of the translations I need to do: $stringDate = November 2009; $output =
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Examples I have seen .properties files with a convention similar to the following: Example
Any examples, tips, guidance for the following scenario? I have retrieved updates from several
Most examples I see about hosting WCF in IIS have you create an Application
Most examples I've seen have scripts in a html page being enclosed by <!--
Examples: 2011-01-01 2011-01-01,2011-01-28,2011-12-31 etc. I don't need it to verify that the dates themselves

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.