Comments (12)
Believe me, It's just a matter of parameter tweaking and rounding errors due to floating point math.
Try to tweak timeToTarget and tolerance to minimize that effect, you probably have to decrease both (not too much though). Often you definitely solve the issue like that. When it doesn't happen you can disable the arrive behavior once the steerable has arrived to the target.
from gdx-ai.
Would it be possible to use another numeric type without those floating errors ? I have really tried a lot of combination of parameters and it never disappear and when it does it's never consistent. It depend of the speed you're coming from.
from gdx-ai.
Yeah double should help to minimize the issue.
Try copying Arrive to DoubleArrive, replace float with double and let me know. 😄
from gdx-ai.
Oh no, I just realized that most of the math is in the code that updates position, velocity, orientation and accelerations. And of course that code is out of behavior classes.
from gdx-ai.
Ok, I will do that. The sad part is that most of libgdx is in float so I will have to convert from Double to Float when updating the sprite position.
from gdx-ai.
Why don't you just disable arrive when you're on target?
from gdx-ai.
Would you implement that in applySteering ?
from gdx-ai.
At line https://github.com/libgdx/gdx-ai/blob/master/tests/src/com/badlogic/gdx/ai/tests/steer/scene2d/SteeringActor.java#L236 replace MathUtils.FLOAT_ROUNDING_ERROR
, whose value is 0.000001f,
with 0.001f.
There you go! Now scene2d arrive stops on target.
As I told you, it's just a matter of tweaking parameters. Actually, updating orientation to the direction of motion with a certain tolerance on 0 velocity is just one of many parameters. 😉
from gdx-ai.
So what I intended to do is to have my ships facing the direction they're going. Either I use independant facing with Arrive coupled to LookWhereYouAreGoing and I have the problem described above (your fix only apply to non independant facing), either I use non independant facing but then I get infinite angular speed when velocity is 0. This is not very realist for a ship. I'm not sure if it's the expected behavior either. Shouldn't a Steerable do a big U-Turn when they are oriented the opposite of where they want to go when they have non independant facing behavior ?
from gdx-ai.
There is a way to fix it. Apply the same fix than you did to the LookWhereYouAreGoing behavior:
I think that would work and solve my issue.
from gdx-ai.
I edited my local version of gdx-ai to fix LookWhereYouAreGoing and it solved my issue :)
from gdx-ai.
I edited my local version of gdx-ai to fix LookWhereYouAreGoing and it solved my issue :)
Ok thanks. Added that threshold to the Limiter interface.
Shouldn't a Steerable do a big U-Turn when they are oriented the opposite of where they want to go when they have non independant facing behavior ?
U-Turn, J-Turn and similar maneuvers require motor control techniques.
from gdx-ai.
Related Issues (20)
- Example for Guards in the Wiki.
- @TaskAttribute for enums does not work HOT 1
- Is there a reason to use getFields instead of getDeclaredField in BTreeParser HOT 5
- Release 1.8.2? HOT 7
- Behavior Trees: Freeze in BehaviorTree#step() in certain conditions HOT 3
- There's a TODO with a link to a page that no longer exists. HOT 2
- Is there something wrong here in Parallel?
- How to correctly pool behavior trees (and tasks)?
- index 81 out of bounds for length 81 HOT 2
- When will gdx-ai released a new version HOT 1
- POOL field in MessageDispatcher should not be static? HOT 1
- TaskAttributes do not appear to populate Tasks for included subtrees
- Broken images in wiki
- Broken Javadocs Links in Wiki
- When I use kryo to serialize btree on android, i got a exception that GuardEvaluator can bot be accessible
- The Fighting Kitten Tutorial is not available
- Running the tests HOT 1
- Are there any plans to release a new version
- Behavior trees Parallel components clearing Sequences
- d
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gdx-ai.