Pressing the keys r and u rotate a cube around the x and y axis respectively. When pressed individually, the rotations are fine however when U then R is pressed it rotates it around a different axis. How do I keep the axis consistent.
Link to model and texture if you want to run the code: https://drive.google.com/drive/folders/1R598KCxo3EbbQIcuzeQX1wYKlu1DJYoV?usp=drive_link
from ursina import *
app = Ursina()
origin = Entity()
rotation_origin = Entity() # creates an empty entity that the camera orbits around
camera.parent = origin
camera.z = -50 # sets initial position of the camera
cubelet = Entity(model='models/cubelet', texture='cublet texture.png', position=Vec3(0, 0, 0), rotation=(0,0,0), scale=(4,4,4))
cubelet.world_parent = rotation_origin
def input(key):
if key=='r':
rotation_origin.rotation_x += 90
print(cubelet.rotation)
if key=='u':
rotation_origin.rotation_y += 90
print(rotation_origin.rotation)
def update():
origin.rotation_y += (mouse.velocity[0] * mouse.left *100) # allows for the camera to be moved by the mouse
origin.rotation_x -= (mouse.velocity[1] * mouse.left * 100)
app.run()
This is part of a bigger program of a 3D model of a Rubik's cube and I am just trying to get the individual pieces to rotate how I want them to.
I have tried anchoring it to an origin, I have tried it using only the cubes axis but still got the same result.