Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 15 Dec 2007
Offline Last Active Feb 03 2013 01:01 PM

Posts I've Made

In Topic: Arrive steering behavior

30 November 2012 - 08:16 AM

Thanks for the reply.

It does decelerate nicely if I remove delta time from the acceleration calculation, but then I get the problem that my object reaches the max speed directly after just one call to Update().

In Topic: Arrive steering behavior

26 November 2012 - 12:27 PM

I found a C# implementation of the same example from the book and it had no parenthesis around deceleration * decelerationTweaker like this:

double speed = distance / (double)deceleration * decelerationTweaker;

When I changed this in my code it appeared to work even with deltaTime:

Velocity = Velocity + acceleration * deltaTime;

I am really confused why I need to remove the parenthesis when all other implementations I have seen (except the one I mentioned above) uses them. I have also tested implementations not from the book and they also result in this oscillating behavior when I use it in my code.

In Topic: Arrive steering behavior

25 November 2012 - 05:01 AM

Thank you for your reply.

Yes I thought keeping deltaTime in the calculation was correct. I am just confused as to why the book author's code work but not mine, I don't see any difference and I have tried using the same default values for mass, max force, max speed.

In Topic: Arrive steering behavior

25 November 2012 - 03:11 AM

Try playing with the DecelerationTweaker Im using 1.3
I only get that problem when the speed is to high.

Did you change something else too? Because if I only change the deceleration tweaker to 1.3 I still get the same problem at default max speed 1.6 for example.

In Topic: Arrive steering behavior

24 November 2012 - 10:43 AM

Thank you for the tip.

I noticed that when I change this line:
Velocity = Velocity + acceleration * deltaTime;

Velocity = Velocity + acceleration;

It appears to work like I expect, it also fixes the seek steering behavior. Can anyone explain this? I thought deltaTime had to be included when calculating both velocity and position. Maybe there is still a problem hidden somewhere.

EDIT: I should add, at higher speeds I need to increase the max force as well.