Two actions with different length

(blackno666) #1


I want an object to have to actions: one constantly scales the object (large - small - large), the other rotates the object by 360°. The length of the Actions are different. I expected a constantly rotating and scaling object…

When playing, both actions start at the same time, but the first one (scaling) stops and only continues after the second animation has finished. Both actions are set to “Loop Stop”.

Both actions are on different layers.

What’s wrong? Or what am I not getting?

2Actions.blend (497.1 KB)


(Cotaks) #2

I did not look at your .blend, but playing 2 animations on the same object at the same time with the same priority is not going to work indeed.Or you need to keyframe both scale and rotation independently. meaning one animation only holds the rotation info and the other only scaling info(never tried though).

option 1: 1 animation doing both, you can keyframe at any frame so one can be faster then the other.
option 2: 1 animation(scaling) and 1 motion brick for the rotation.
option 3: write both with python.

(blackno666) #3


thanks for your answer. I do not fully agree, though. My scale action only affects the scaling, my rotation action only the rotation.

The blender api states " priority ( integer ) – only play this action if there isn’t an action currently playing in this layer with a higher (lower number) priority". Since I do not have two action in the same layer, priority can be ignored.

I also tried using a python script:

import bge

scene = bge.logic.getCurrentScene()

o = scene.objects['Suzanne']

o.playAction('Scale', 0, 19, 0, play_mode = bge.logic.KX_ACTION_MODE_LOOP)
o.playAction('Rotate', 0, 99, 1, play_mode = bge.logic.KX_ACTION_MODE_LOOP)

However, the result is the same as before (which is not unexpected, since it does the same).

Of course there’s still the solution to have one action containing both, the scaling and the rotation but I’d prefer to have two actions.

(Mobious) #4

The BGE action system has a lot of bugs and issues. I think the problem here is that to play multiple actions at the same time on an object you need to use layers, but action layers don’t seem to work properly on game objects in the BGE - they only work with armatures. If you create your actions on an armature, use different action layers, and parent your mesh to that it should work.

(Cotaks) #5

I meant with python to just use python to rotate and scale the object, so without even using animations.
Also are animation needed? as i said before motion brick can rotate the object for you. then you only need the scaling animation.

If you need animations i would try mobious solution first and add a bone/armature to it, see if that works.