anyone workout quick way to calc actor distance
TwistedMech
Member Posts: 408
If my scene has several actors and I want to know which one is closest to the main game character so that the main character auto follows the closest actor, anyone work out an easy way to do this?
Comments
http://z.about.com/d/math/1/5/e/D/pythagoreantheorem.gif
You need the co-ordinates of the two objects
object1x
object1y
object2x
object2y
I believe this is the formula for distance between the two objects
sqrt ( ( ( object2y - object1y ) * ( object2y - object1y ) ) + ( ( object2x - object1x ) * ( object2x - object1x ) ) )
Hope this helps
magnitude(object2x-object1x,object2y-object1y)
thanks for the info
We could do with an array rule or some way to read each actor property in the scene so we can apply a magnitude calc or have some kind of method to list actors near to a chosen actor. :-(