Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6873801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:06:55+00:00 2026-05-27T04:06:55+00:00

I am trying to implement steering behaviours in my XNA game and mostly there

  • 0

I am trying to implement steering behaviours in my XNA game and mostly there but could use a hand with some little things. The behaviours work perfectly well, my issues lie in the timing and magnitudes of the updates.

(I am using SharpSteer (almost entirely at this point) it can be found here:

http://sharpsteer.codeplex.com/SourceControl/changeset/view/18102)

The Update() method is where I am struggling. Currently I am using this method (straight from SharpSteer)

    // apply a given steering force to our momentum,
    // adjusting our orientation to maintain velocity-alignment.
    public void ApplySteeringForce(Vector3 force, float elapsedTime)
    {
        Vector3 adjustedForce = AdjustRawSteeringForce(force, elapsedTime);

        // enforce limit on magnitude of steering force
        Vector3 clippedForce = Vector3Helpers.TruncateLength(adjustedForce, MaxForce);

        // compute acceleration and velocity
        Vector3 newAcceleration = (clippedForce / Mass);
        Vector3 newVelocity = Velocity;

        // damp out abrupt changes and oscillations in steering acceleration
        // (rate is proportional to time step, then clipped into useful range)
        if (elapsedTime > 0)
        {
            float smoothRate = Utilities.Clip(9 * elapsedTime, 0.15f, 0.4f);
            Utilities.BlendIntoAccumulator(smoothRate, newAcceleration, ref acceleration);
        }

        // Euler integrate (per frame) acceleration into velocity
        newVelocity += acceleration * elapsedTime;

        // enforce speed limit
        newVelocity = Vector3Helpers.TruncateLength(newVelocity, MaxSpeed);

        // update Speed
        Speed = (newVelocity.Length());

        // Euler integrate (per frame) velocity into position
        Position = (Position + (newVelocity * elapsedTime));

        // regenerate local space (by default: align vehicle's forward axis with
        // new velocity, but this behavior may be overridden by derived classes.)
        RegenerateLocalSpace(newVelocity, elapsedTime);

        // maintain path curvature information
        MeasurePathCurvature(elapsedTime);

        // running average of recent positions
        Utilities.BlendIntoAccumulator(elapsedTime * 0.06f, // QQQ
                              Position,
                              ref smoothedPosition);
    }

This works, but the changes from frame to frame are huge due to the elapsed time multiplier (I think SharpSteer uses it’s own game clock and not gameTime, I am using gameTime)

I am looking for a way to slow this down a lot, and to use speed values in a greater range than 1.0f.

Currently I am using a speed of 1.0f and a maxForce of 1.0f. I have noticed that Velocity is always (0,0,0) and elapsedTime is 16 (this is called 60 times per second)
smoothRate is always 0.4f, also because elapsedTime is too large.

If anyone could help be balance the speed of the vehicle somewhat I’d appreciate it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:06:55+00:00Added an answer on May 27, 2026 at 4:06 am

    increasing the mass will dampen (slowdown) acceleration for the same amount of force coming into the method. Are you sure you have the appropriate mass value set?

    Also, is your velocity representing units per second? if so, then an elapsed time of 16 milliseconds should be 0.016;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to implement AVAudioplayer and get some metering data of the played music, but
I am trying to implement obstacle avoidance behavior from the paper steering behaviours for
am trying to implement fluent nhibernate in MVC project...there were no build errors... but
Trying to implement Piwik using REST API over http but need a little help.
im trying to implement some behaviors when a mapview element scrolls... by coding a
Trying to implement some nested loops that are spitting out good old nested html
Trying to implement the following structure from c to use NSArray in objective-c: In
trying to implement a multiplayer. Using the sample from Game Center - Sending and
Im trying to implement some code i found on a website which duplicates a
Trying to implement the new FP 10.1 Global error handler into my projects but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.