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

Implement max steering constraint #234

Open
netgusto opened this issue Nov 25, 2017 · 1 comment
Open

Implement max steering constraint #234

netgusto opened this issue Nov 25, 2017 · 1 comment

Comments

@netgusto
Copy link
Member

As explained here: ByteArena/ba#15 (comment)

Pseudocode of current implementation (incorrect):

In pseudocode:

var curvelocity Vec2 = GetCurrentVelocity()
var newvelocity Vec2 = GetDesiredVelocity()

var maxSteeringForce Vec2 = GetMaxSteeringForce()

var curmag float64 = curvelocity.Mag()
var diff float64 = newvelocity.Mag() - curmag

if math.Abs(diff) > maxSteeringForce {
    if diff > 0 {
        newvelocity = newvelocity.SetMag(curmag + maxSteeringForce)
    } else {
        newvelocity = newvelocity.SetMag(curmag - maxSteeringForce)
    }
}

The current implementation is incorrect as it does not take into account the changes of direction between the two velocities.

@xtuc
Copy link
Member

xtuc commented Nov 25, 2017

Do we plan to support some kind of drag force? Even if null atm

Let's talk about that stuff tomorrow

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