Here's my code:
import bge
from bge import logic
from math import degrees
def mimic_process():
cont = logic.getCurrentController()
own = cont.owner
own_rotation = own.worldOrientation.to_euler()
mimic = own.parent
mimic_rotation = mimic.worldOrientation.to_euler()
own_rotation_x = "%.0f" % degrees(own_rotation.x)
own_rotation_y = "%.0f" % degrees(own_rotation.y)
own_rotation_z = "%.0f" % degrees(own_rotation.z)
mimic_rotation_x = "%.0f" % degrees(mimic_rotation.x)
mimic_rotation_y = "%.0f" % degrees(mimic_rotation.y)
mimic_rotation_z = "%.0f" % degrees(mimic_rotation.z)
rotation_fix_x = own_rotation_x - own_rotation_y
if (own_rotation_x > mimic_rotation_x):
own.applyRotation((rotation_fix_x, 0, 0), True)
print('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')
keyboard = bge.logic.keyboard
if bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.OKEY]:
own.applyRotation((0.01, 0, 0), True)
mimic_process()
The line rotation_fix_x = own_rotation_x - own_rotation_y
is the cause of the problem. I got my object's rotation, put it in a variable, did the same with another object [the mimic object], and attempted to subtract them out. I don't know why it wont subtract them. How can I fix this? Thanks.