I have an analog controller and I want to change action speed on the runtime, but without interrupting the loop of the action. I tried this but it doesn't work. The loop restart all the time when the variable_that_changes changes.

armature_object.playAction("run",0,30,play_mode = bge.logic.KX_ACTION_MODE_LOOP, speed= variable_that_changes)

I suggest to use skip the automatic play modes and implement an on counter.

You can do this even without python. Define a float property "frame" that is supposed to hold the frame of the pose to be played.

Whenever the property change activate an action actuator in property mode with that property.

enter image description here

Now you can implement logic that manipulates the property frame.

  • $\begingroup$ Just adding "frame" in the action property doesn't work, but adding it also in Frame Property works! Thanks. Modify your answer and I will accept it! $\endgroup$ – user36531 Oct 14 '16 at 12:02
  • $\begingroup$ Oh sorry I forgot the true level triggering. Now it works! Thank you $\endgroup$ – user36531 Oct 14 '16 at 12:06
  • $\begingroup$ However it seems working better using the AlwaysSensor with the true level triggering. $\endgroup$ – user36531 Oct 14 '16 at 12:08
  • $\begingroup$ Using the always sensor is inefficient - unless the property changes all the time. As this is your current situation, it should be fine. $\endgroup$ – Monster Oct 18 '16 at 5:12

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.