The Daily Click ::. Forums ::. Klik Coding Help ::. How to track the path of a moving object
 

Post Reply  Post Oekaki 
 

Posted By Message

vetmora120



Registered
  07/01/2010
Points
  273
14th October, 2015 at 14/10/2015 09:23:05 -

Not sure how easy this is, but I'm trying to find a way to track a top-down objects movement path. I then want to check if it's just moved in a circular path and then run an event.

I was thinking I could somehow use the surface object, but I should note that I'm using Android and it's not available.

Any ideas on how to best achieve this?

Cheers guys.

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
16th October, 2015 at 16/10/2015 17:56:59 -

Track it's path? Do you mean like draw it's path on the screen? Or do you want to do pattern detection?

For the drawing you could just create a bunch of objects to represent the path of the object. Although I'm not sure how a android would handle this performance wise.

Pattern detection is a little more complicated. Also we need a little more info to decide how we should approach this. Should the object move in a perfect circle? Would a square work? Who is controlling the movement of this object? Is it random?

If the movement isn't random then you could probably get away with tying the pattern detection to whatever would cause the object to move in the desired pattern. (like a circle)

If the movement is random, then just keep a record of the last few positions of the object and then check if the points are equidistant from an average of all their positions. Based on how large of a circle you want to support simple adjust how far back you keep the old position data. You'll most likely need an array for this, especially if you have more than one object to track.

 
n/a

vetmora120



Registered
  07/01/2010
Points
  273
24th October, 2015 at 24/10/2015 11:57:23 -

Thanks for the feedback, UrbanMonk.

I need more of a pattern detection and the movement won't be random. The idea is that once you've performed a circular doughnut/burnout, then you get a bonus.

I've attached the source if you would like to take a look at it.

https://dl.dropboxusercontent.com/u/9919361/Project.mfa

 
n/a
   

Post Reply



 



Advertisement

Worth A Click