```python from ursina import * from itertools import product def parent_child(axel, layer): for c in cube: c.position, c.rotation = round(c.world_position,1), c.world_rotation c.parent = scene center.rotation = 0 for c in cube: if eval(f'c.position.z{axel}') == layer: c.parent = center def input(key): if key not in rot_dict: return axel, layer, angle = rot_dict[key] parent_child(axel, layer) shift = held_keys['shift'] eval(f'center.animate_rotation_{axel}({-angle if shift else angle}, duration = 0.5)') app = Ursina() window.borderless = False window.size = (800, 800) window.position = (2000, 200) EditorCamera() center = Entity() rot_dict = {'u': ['y', 1, 90], 'e': ['y', 0, -90], 'd': ['y', -1, -90], 'l': ['x', -1, -90], 'm': ['x', 0, -90], 'r': ['x', 1, 90], 'f': ['z', -1, 90], 's': ['z', 0, 90], 'b': ['z', 1, -90]} cube = [] for pos in product((-1,0,1), repeat=3): cube.append(Entity(model='Teil_46_model.obj', texture='rubikscube.png', position=pos, scale=0.5)) #print(pos) #checked that it worked app.run() ## the pos in product the above does the same as below - #for x in range(-1,2): # for y in range(-1,2): # for z in range(-1,2): # pos = (x,y,z) ``` Imagine actually making the rubiks cube - ![[Pasted image 20230408064712.png]]