|
1 | 1 | from graphics.graphics_canvas import *
|
2 | 2 | from graphics.common_functions import *
|
3 | 3 |
|
| 4 | +# TODO |
| 5 | +# update non-stl obj creation (position wrong, ref wrong) |
| 6 | + |
4 | 7 |
|
5 | 8 | class DefaultJoint:
|
6 | 9 | """
|
@@ -50,8 +53,8 @@ def __init__(self,
|
50 | 53 | self.__length = max(self.__graphic_obj.length, self.__graphic_obj.width, self.__graphic_obj.height)
|
51 | 54 |
|
52 | 55 | # Set the other reference frame vectors
|
53 |
| - self.__graphic_ref = draw_reference_frame_axes(self.__connect_to, self.__x_vector, self.__x_rotation) |
54 | 56 | self.__update_reference_frame()
|
| 57 | + self.__graphic_ref = draw_reference_frame_axes(self.__connect_to, self.__x_vector, self.__x_rotation) |
55 | 58 |
|
56 | 59 | def update_position(self, new_pos):
|
57 | 60 | """
|
@@ -241,6 +244,12 @@ def __set_graphic(self, given_obj):
|
241 | 244 | up=z_axis_vector)
|
242 | 245 | # Set the boxes new origin
|
243 | 246 | graphic_obj = compound([graphic_obj], origin=vector(0, 0, 0), axis=x_axis_vector)
|
| 247 | + # Set the boxes x and y vector first before applying the Z axis |
| 248 | + # Otherwise rotates to the new vector from the original point (unintentionally rotating around it's z axis) |
| 249 | + graphic_obj.axis = vector((self.__connect_to.x - self.__connect_from.x), |
| 250 | + (self.__connect_to.y - self.__connect_from.y), |
| 251 | + 0) |
| 252 | + graphic_obj.axis.z = (self.__connect_to.z - self.__connect_from.z) |
244 | 253 | return graphic_obj
|
245 | 254 | else:
|
246 | 255 | # TODO When texture application available, put it here
|
|
0 commit comments