Monday, December 12, 2011

Kart Racer- Testing the Steering Actuator

Let me introduce you to Blender's Steering Actuator:





















This actuator finds a target object [in this case, Target1], draws a path within a defined area [NavMesh], and then steers the object along this path in order to reach the target.

To help troubleshoot/fix the current AI, I decided to test the steering actuator with just a cube. This would rule out any variables that the Vehicle Wrapper might have caused. This is what I figured out.

The steering actuator not only steers an object left or right, but is also responsible for physically moving it forward [by means of a 'velocity' setting]. If the 'velocity' setting in the actuator is set to 0, it won't respond- meaning it won't return a steering vector [which is essential for steering the kart.] This is simply due to how the actuator handles velocity- if it's set to 0, it assumes it's not going anywhere, so it doesn't bother to return this vector even if it is physically moving.

Before I discovered this, I set the 'velocity' value to 0, since I wanted the VW to take care of forward movement. As a workaround, I tried setting it to a ridiculously low value [0.001] in order to get the actuator to respond without affecting forward movement too much.  It actually worked when I propelled the cube separately by means of the simple motion logic brick, and the script I wrote correctly returned the steering vector. 

However, it still won't return a steering vector when applied to the Vehicle Wrapper, so something in there is conflicting. Even once I do get it, I still need to find a way to manipulate this vector to steer the car left or right. Looks like there's a lot ahead of me.

No comments:

Post a Comment