I’m in trouble and I hope someone can help me. I am doing a construction system. With Raycast I use the normal face of a cube where the hit happens and position another cube on this face. Based on the axis difference, I find an angle then even if a cube is inclined the cube to be built appears with the correct rotation.

The problem is that when I rotate this cube it is lined with the cube exists. I had already managed to do this in the Engine tank. But deciding to do in Armory because of physics to apply the same logic I’m not succeeding.

The first thing is that the axles are directed. The vertical axis of armor is Z and the bears is Y. I already changed this by applying the logic of Z to Y and Y in Z. But I’m not trying to be successful. When rotating the cube at the wax outside the game I noticed that I rotate it with local rotation. Everything works, but using Node> Transform, Rotate Object, even selected local F.O.R. it rotates on the global axis.

Well if anyone can help me please. Tell me how to solve this or how I can make the cube rotate on the local axis.

source original:

# Calculate the differences in positions

```
entity_pos = hit_info.entity.position
entity_rot = hit_info.entity.rotation
diff_x = entity_pos.x - cube_ghost.position.x
diff_y = entity_pos.y - cube_ghost.position.y
diff_z = entity_pos.z - cube_ghost.position.z
# Calcule a diferença máxima
diff_max = max(abs(diff_x), abs(diff_y), abs(diff_z))
# Determine the main axis based on the maximum difference
if diff_max == abs(diff_x):
#print('# O eixo é X')entity_pos
#angle_degrees = math.degrees(math.atan2(diff_z, diff_x)) #+ math.pi
ghost_rotation = Vec3(angle_to_rotation, 0, 0)
elif diff_max == abs(diff_y):
if entity_pos.y > cube_ghost.position.y:
#print(' - Y')
angle_degrees = math.degrees(math.atan2(diff_z, diff_y) - math.pi / 2)
ghost_rotation = Vec3(angle_degrees, 0, angle_to_rotation)
else:
#print(' + Y')
angle_degrees = math.degrees(math.atan2(diff_z, diff_y) + math.pi / 2)
ghost_rotation = Vec3(angle_degrees, 0, angle_to_rotation)
elif diff_max == abs(diff_z):
#print(':: Z')
angle_degrees = math.degrees(math.atan2(diff_y, diff_z))
ghost_rotation = Vec3(angle_degrees*-1, 0, angle_to_rotation)
cube_ghost.visible = True
ghost_position = hit_info.entity.position + hit_info.world_normal
cube_ghost.position = ghost_position
cube_ghost.rotation = ghost_rotation
```

I did the same with an Armorry look script. But it doesn’t work the same.