I got the sample level up and running - and I'll let my video do the rest of the talking! :)
This week, I worked on rendering objects with direction and velocity. The agent is rendered as a triangular object, which points at its current heading. The green line represents the velocity of the object. The text underneath represents the speed. I worked on additional behavior, which is the arrive behavior. Unfortunately I ran into a bug, where the velocity doesn't seem to be getting updated consistently. On further investigation, it turns out that the update loop was running so fast that the delta time between frames was turning up to be 0. What confuses me is that if the delta time is 0, then the agent shouldn't be moving at all, based on these lines: Vec2 Acceleration = SteeringForce / mMass ; mVelocity += Acceleration * deltaTime ; mVelocity . Truncate ( GetMaxSpeed ()); mPosition += mVelocity ; On further debugging, I discovered that the delta time is non-zero for the first few updates (suggesting that there was perhaps some setup code ...
Comments