Does anyone know of a example game with source code or a snipper that shows how you could use a locomotion layer in your game?
For example, a car has the option to accelerate, brake, steer left and steer right. These are 4 object methods that can be called. For player input it would be as simple as:
However, for the AI driven agents a steering force has to be calculated by some activated steering behavior. This steering force can be a vector that when added to the velocity vector makes sure the agent moves to the desired target. When calculating this steering force the max. turn rate, objects mass, max force and so on is taken into consideration.
The steering behaviors and applying the steering force works fine. But I need to implement the locomotion layer. And that's where I'm stuck.
The way I see it the calculated steering force is an instruction for the locomotion layer. It tells whether to brake or accelerate and to steer to the left or right, or not at all. It could also activate animation sequences.
For example, an airplane that's making a sharp turn has to alter its pitch. In a 2D sprite based game this would mean execution an animation showing this.
I've been looking around but can't find any examples. If anyone knows of any please let me know. Thanks.
For example, a car has the option to accelerate, brake, steer left and steer right. These are 4 object methods that can be called. For player input it would be as simple as:
If KeyDown(KEY_UP) Self.Accelerate() End If etc...
However, for the AI driven agents a steering force has to be calculated by some activated steering behavior. This steering force can be a vector that when added to the velocity vector makes sure the agent moves to the desired target. When calculating this steering force the max. turn rate, objects mass, max force and so on is taken into consideration.
The steering behaviors and applying the steering force works fine. But I need to implement the locomotion layer. And that's where I'm stuck.
The way I see it the calculated steering force is an instruction for the locomotion layer. It tells whether to brake or accelerate and to steer to the left or right, or not at all. It could also activate animation sequences.
For example, an airplane that's making a sharp turn has to alter its pitch. In a 2D sprite based game this would mean execution an animation showing this.
I've been looking around but can't find any examples. If anyone knows of any please let me know. Thanks.