collinhover / impactplusplus

Impact++ is a collection of additions to ImpactJS with full featured physics, dynamic lighting, UI, abilities, and more.
http://collinhover.github.com/impactplusplus
MIT License
276 stars 59 forks source link

'moveFrom' not working? #86

Closed arakash92 closed 10 years ago

arakash92 commented 10 years ago

I have an entity I'd like to have move away from another entity.

So I do entity.moveFrom(anotherEntity)

But it doesn't move at all. have I missed something?

collinhover commented 10 years ago

It's possible the recent pathfinding changes affected moving from. That is one of the things I didn't have time to test, so I'll take a look now.

collinhover commented 10 years ago

Tested moveFrom and it is working as expected. Keep in mind that moving from is only available to characters, and then only if they have performance === ig.CONFIG.DYNAMIC and canPathfind === true. It is very possible that, in the case of a creature, it is trying to move to a prey / predator and that is conflicting with your manual moveFrom call. In the case of a creature, use the predatorName, predatorClass, predatorType, or predatorGroup properties to use moving from properly.

Moving from is also at best just a guess based on where the character is, where the character it is trying to move away from is, and which possible path is the cheapest that would take the character the furthest away. Sometimes it is possible for moving from to get backed into a corner. Move to is far more accurate, because it knows where it is going.

If you still can't get it to work, reopen the issue and give me some more information, such as the specifics on the entity and a screenshot of the situation.

arakash92 commented 10 years ago

It turned out to be a problem on my end, thanks though.