This next little patch is very very simple. It’s a strategy to change the ‘pivot point’ of an object, i.e. the point around which it rotates when you send it the rotatexyz message. By default objects are placed at the origin, (0.,0.,0.), and their pivot point is located at the center.
I never really needed to change this untill recently, when I needed to place different planes around, but have them all rotate along a single axis. For instance : when you create a plane with jit.gl.gridshape, the plane will be centered in your window. Now, what if you want to rotate it like it is a door? So not around it’s center, but along the left or right side of the plane…? The patch below demonstrates the extremely simple way of accomplishing just that.
Change the position in the of the jit.gl.gridshape in the patch to say 0.3 0. 0., and then rotate the jit.gl.sketch object along the y-axis.
Easy eh? This hardly qualifies as a tutorial! Download link below.