I am new to Blender and but working on some simulation which involves Blender Game Engine. I want my mesh to follow a path while in motion. For that I am doing the following:

  • create a KX_SteeringActuator
  • configure it on PATHFOLLOWING
  • configure velocity, acceleration, turn speed
  • potentially setting target and navigation mesh (checking selfterminated)

So my python script has some code like below:

actuators['Steering'].behavior = Path_following
actuators['Steering'].velocity = 3.000
actuators['Steering'].acceleration = 3.000
actuators['Steering'].turnspeed = 120.000
actuators['Steering'].distance = 1.000
actuators['Steering'].target = target
actuators['Steering'].navmesh = navMeshWhole

Now, I can not figure out how do I activate the above actuator, so that my mesh object starts moving towards the target. I want to have a python controller for the above Actuator. If any one has idea or dealt with similar problem, please guide me. I want to write a python controller to activate this actuator.

--> If I have a Keyboard sensor, linked with an And controller which is linked with the above actuator then, if Game Engine started (pressing p in blender), it gives desired behavior on the Keyboard-Sensor key-press. The mesh object navigates towards the target object, following the path. Dont want to use Keyboard sensor and And controller. Thanks a lot !

  • $\begingroup$ I could manage to solve it. I used a property sensor and activate it using some object property. And then, while game engine running, I dynamically change the object property value. Like "0" for making the mesh move forward and "1" for backward and so on. I used MeshName['PropertyName'] = 0 or 1. So, if it is set to 1 then sensor gets active and propels my mesh. :) :) $\endgroup$ – sosoup Apr 16 '15 at 16:19

Also you can controller.activate(actuator) like this:


It can be done this way:

  • Create an ALWAYS sensor (Check the 'True' box for the script to run constantly)
  • Create a AND and PYTHON controller
  • Create a STEERING actuator

Connect all;

enter image description here

Now just set it up with the python script.

See some commands from this actuator:

# Get controller
cont = logic.getCurrentController()

# Get scene
scene = logic.getCurrentScene()

# Current object
own = cont.owner

# Get the target to follow on the scene
varTarget = scene.objects['objTarget']

# Variable that receives 'actuator steering'
varSteering = cont.actuators['Steering']

# Definitions of actuator

# Target object
varSteering.target = varTarget

# Detection distance
varSteering.distance = 10.0

# Movement speed
varSteering.velocity = 3.0

# Mode of behavior
varSteering.behavior = 1

You can get everything about the steering actuator in https://docs.blender.org/api/2.79/bge.types.KX_SteeringActuator.html#bge.types.KX_SteeringActuator


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.