Page MenuHome

Expose steering actuator path, as a list to the player
Closed, ResolvedPublic

Description

Currently the steering actuator is quite powerful, however it is not easy to set up custom behaviors,

I would like to be able to get the steering path, and act on it myself, rather then having the actuator move and face the actor.

is there anyway we can expose the current path to the user as a list?

Steering.path = [a list of world vectors]

Thanks!

this is as close as I can get to turning while standing THEN only walking when the actor is facing the next 'Kink' in the path.
https://www.youtube.com/watch?v=Ou8xG5bDhPQ

Details

Type
Design

Event Timeline

I had a look at the code and tried to make a "pre-patch" to get path (not set) http://www.pasteall.org/62285/diff (testfile: http://www.pasteall.org/blend/39263), but it doesn't work as expected because it seems that the path is not computed on 1 frame. So if you click on 1 frame to change steering target and at the same time you tell blender to give you the path, it will give you the old path because the new path is not computed yet (I think)... So it can be difficult to implement such a feature, I guess.

But you can use the existing API to change player behaviour (uncheck face axis, and in python alignAxisTo(target), eventually disable steering actuator while player is aligning to target...
Or you can play with all this attributes:

KX_PYATTRIBUTE_INT_RW("behavior", KX_STEERING_NODEF+1, KX_STEERING_MAX-1, true, KX_SteeringActuator, m_mode),
KX_PYATTRIBUTE_RW_FUNCTION("target", KX_SteeringActuator, pyattr_get_target, pyattr_set_target),
KX_PYATTRIBUTE_RW_FUNCTION("navmesh", KX_SteeringActuator, pyattr_get_navmesh, pyattr_set_navmesh),
KX_PYATTRIBUTE_FLOAT_RW("distance", 0.0f, 1000.0f, KX_SteeringActuator, m_distance),
KX_PYATTRIBUTE_FLOAT_RW("velocity", 0.0f, 1000.0f, KX_SteeringActuator, m_velocity),
KX_PYATTRIBUTE_FLOAT_RW("acceleration", 0.0f, 1000.0f, KX_SteeringActuator, m_acceleration),
KX_PYATTRIBUTE_FLOAT_RW("turnspeed", 0.0f, 720.0f, KX_SteeringActuator, m_turnspeed),
KX_PYATTRIBUTE_BOOL_RW("selfterminated", KX_SteeringActuator, m_isSelfTerminated),
KX_PYATTRIBUTE_BOOL_RW("enableVisualization", KX_SteeringActuator, m_enableVisualization),
KX_PYATTRIBUTE_RO_FUNCTION("steeringVec", KX_SteeringActuator, pyattr_get_steeringVec),
KX_PYATTRIBUTE_SHORT_RW("facingMode", 0, 6, true, KX_SteeringActuator, m_facingMode),
KX_PYATTRIBUTE_INT_RW("pathUpdatePeriod", -1, 100000, true, KX_SteeringActuator, m_pathUpdatePeriod),
KX_PYATTRIBUTE_BOOL_RW("lockZVelocity", KX_SteeringActuator, m_lockzvel),

Maybe someone has a better technique than mine to get the path...

navmesh.findPath()
works quite well,

I had not known about it when I made this report.

Ok, I didn't know that. Could you please close the report, so?

Ulysse Martin (youle) closed this task as Resolved.Nov 20 2015, 6:38 AM
Ulysse Martin (youle) claimed this task.

Sorry to insist, but when you open a bug report, then you find a solution to your problem, It would be cool to:

  1. Update your report to tell people that are reading your report that you have a solution and what the solution is.
  2. Close your bug report.

Why?: Because there are people that read bug reports and task lists every day. If like me they try to find a solution to your problem/suggestion and spend many hours to navigate into the Blender sources for nothing, it's a bit frustrating.

Thanks!