0
$\begingroup$

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)
$\endgroup$

1 Answer 1

0
$\begingroup$

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.

$\endgroup$
4
  • $\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, 2016 at 12:02
  • $\begingroup$ Oh sorry I forgot the true level triggering. Now it works! Thank you $\endgroup$
    – user36531
    Oct 14, 2016 at 12:06
  • $\begingroup$ However it seems working better using the AlwaysSensor with the true level triggering. $\endgroup$
    – user36531
    Oct 14, 2016 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, 2016 at 5:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .