Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate distance between steerables in a 2D wrapped around environment #40

Open
implicit-invocation opened this issue Jul 14, 2015 · 3 comments

Comments

@implicit-invocation
Copy link

Imagine our characters is moving on the surface of a sphere. So there will be 2 ways to calculate distance between them. But all of gdx-ai behaviors use owner.getPosition() to calculate distance.

I think Steerable interface should have getDistance(point:Vector2):float getDistanceSq(point:Vector2):float method and behaviors will use them to decide how to seek, evade, flee...

@davebaol
Copy link
Member

Hmmm... Shouldn't something like

toTarget.set(target.getPosition()).sub(owner.getPosition());

be affected too?

@implicit-invocation
Copy link
Author

and getDistance(agent:Steerable):float, getDistanceSq(agent:Steerable):float
or getToTargetVector(agent:Steerable, agent:Steerable):Vector2, maybe

@davebaol
Copy link
Member

At a first glance I'd say that toTarget should be an instance of a class that extends Vector2 and overrides the appropriate methods.
But currently there's no way to set vectors internally used by behaviors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants