- A* version: [5.1.1]
- Unity version: [2022.3.29]
Hello,
I’m having a bit of a time trying to figure out how to calculate a jump using NodeLink2 with a FollowerEntity, specifically when using a custom TraversalProvider.
For cases not using TraversalProvider (using my “jump action” to create a jump in real time) I can use my ballistics package to determine whether a jump will be blocked by an object using raycasts, create a link if viable, and cache the jump data on the node. However, as I have found, TraversalProvider runs on another thread so I can’t use the Unity Physics functions. It would be nice to use TraversableProvider as I have had success using it to determine whether a unit has a key required to open a door NodeLink2, but I’m not tied to it.
Now, before I go too far trying to figure out how to run a batch of RaycastCommands on the main thread and communicate that back to the TraversalProvider thread (if this is even a sane thing to do), is there a better way to go about this?
All units have their own “jump power” to calculate their trajectory so having each NodeLink2 calculate a single jump (say jump power 10) will potentially not work for a unit with a jump power of 5.
Me brainstorming solutions:
Can I know which NodeLink2s the unit has on its calculated path and run the calculations while the unit is en route, block links that wont work, and recalculate the path?
Could I do these calculations as the unit tries to traverse a link, abort if not viable, blacklist the node, and recalculate somehow? What would be a good way to blacklist them? Something similar to BlockManager?
My simple brute solution would be running a series of tests from the NodeLink2 every time it updates for a range of jump powers so a unit could know if its within an acceptable range. These links can update quite frequently as they are on dynamic moving platforms and each platform will have a minimum of 4 links. So it would be a waste to constantly recalculate these (twice per: a start jump and an end jump) when units aren’t trying to reach them. Then again, I am far away from having performance matter.
Any suggestions or affirmations of my proposed solutions would be helpful before I make this way more complicated than it should be or use bad practices.
Thank you.