Realtime armature control in game engine

Hi.
This blend can not work on my mac.
On windows is fine.
I think this is a bug…

Does anybody know any workaround?

Hi @MarcoIT, the project bonTest.blend was very usefull for me, but I would like to change the rotation mode of the bones from XYZ Euler to Quaternion, because the rotation data that I’m applying to the bones are in quaternion. Is it possible to make this change in the project? I tried doing this through the panel, and change the code with the command b2.rotation_quaternion = q, where q is in quaternion, but the cube doesn’t move.
Thanks in advance!

Hi @MarcoIT, the project bonTest.blend was very usefull for me, but I would like to change the rotation mode of the bones from XYZ Euler to Quaternion, because the rotation data that I’m applying to the bones are in quaternion. Is it possible to make this change in the project? I tried doing this through the panel, and change the code with the command b2.rotation_quaternion = q, where q is in quaternion, but the cube doesn’t move.
Thanks in advance!

i not sure if is necessary this trasformation (quaternion -> euler -> quaternion).
but can be .
the quaternion not seem a thing “writable” .
anyway this give the same kind of rotation , of the blend “bonTest” keeping the bone as quaternion in the UI :wink:


import bge
from mathutils import Euler, Quaternion



"""
def bone(cn): # using only euler
    ow=cn.owner
    key = bge.logic.keyboard.events
    
    
    b1=ow.channels["b1"]
    b2=ow.channels["b2"]
    
    
    
    rot=b2.rotation_euler
    add=0.01
    
    
    if key[bge.events.WKEY]:
        b2.rotation_euler=(rot[0] + add,    rot[1],         rot[2]      )
        
    if key[bge.events.SKEY]:
        b2.rotation_euler=(rot[0] - add,    rot[1],         rot[2]      )
        
    if key[bge.events.AKEY]:
        b2.rotation_euler=(rot[0],          rot[1] + add,   rot[2]      )


    if key[bge.events.DKEY]:
        b2.rotation_euler=(rot[0],          rot[1] - add,   rot[2]      )
        
"""
        
        
        
def bone(cn): # using quaternion 
    ow=cn.owner
    key = bge.logic.keyboard.events
    
    
    b1=ow.channels["b1"]
    b2=ow.channels["b2"]
    
    
    
    eul = Quaternion(b2.rotation_quaternion).to_euler()
    add = 0.01
    
    if key[bge.events.WKEY]:
        eul.x += add      
        
    if key[bge.events.SKEY]:
        eul.x -= add
        
    if key[bge.events.AKEY]:
        eul.y += add

    if key[bge.events.DKEY]:
        eul.y -= add
    
    new_q = eul.to_quaternion()
    b2.rotation_quaternion = new_q
    
    ow.update() # this can be unnecessary