Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Measuring distance in between objects, and another question  (Read 3033 times)

0 Members and 1 Guest are viewing this topic.

zaskaggs

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 3
    • View Profile

I have a couple of (hopefully easy) questions. These questions are about a 2d game only, not 2.5d.

1) Is there any way to measure distance in Wintermute? By pixels would be nice. Could you calculate the distance between two objects, or between an object and the cursor for example?

2) Is there anyway to determine whether or not an actor has a straight path to a location? That is to say, that his path isn't blocked by an impassable region so that he'd have to walk around it. What I want to do is give the player a gun and only let him use it only if he has a clear shot at the target, otherwise I want him to have to walk towards the target until he does have a clear shot.

I hope these questions made sense. Thanks for your time.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Measuring distance in between objects, and another question
« Reply #1 on: May 26, 2010, 03:45:46 PM »

Distance can be calculated easily with a bit of math, see here: http://forum.dead-code.org/index.php?topic=2808.msg17747#msg17747

As for the second question, unfortunately it's not possible to determine this easily using scripts. One would need to plot an imaginary line, and test each point using the Scene.IsBlockedAt() method.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

zaskaggs

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 3
    • View Profile
Re: Measuring distance in between objects, and another question
« Reply #2 on: May 26, 2010, 08:38:40 PM »

This should get me going in the right direction.  :)
I appreciate the quick response.
Logged
 

Page created in 0.037 seconds with 20 queries.