This piece of code shows two bugs...
1) An entity once scaled, does not 'pick' properly, the pick routine seems to detect the unscaled mesh. Test this by changing the scale of the cube.
2) Deformation of the entity when an entity uses "EntityAlignTowards()", see the cube deform as it rotates around the axis, only when EntityAlignTowards() is used. This could explain the gimbal lock I had ealier in a camera, as its parent was the cube?
GLOBAL camera
camera=EntityCreateCamera()
EntitySetCameraRange(camera, 1, 1000)
EntityEnable(camera, TRUE)
cube = EntityCreateCuboid(30,30,30)
EntityScale(cube,0.2,0.2,0.2) // Take this line out to see Picking working properly
axis = EntityCreateAxes(20)
piv = EntityCreatePivot()
EntitySetPosition(piv, 0, 0, 0)
EntitySetPosition(camera, 0, 13, -100)
EntityParent(cube, axis)
EntityMove(cube, 40, 0, 0)
EntitySetPickable(cube, TRUE);
EntitySetName(cube, "cube")
EntitySetPickable(haupt, TRUE);
EntitySetName(axis, "axis")
WHILE TRUE
EntityRotate(axis, 0.1,0.1,-0.1)
EntityAlignTowards(cube,axis) // Take this line out to stop the cube getting deformed
EntityDrawSystem()
// Camera picking
MOUSESTATE mx, my, b1, b2
PRINT "X", mx-8, my-8
pick = EntityCameraPick(mx, my)
IF pick>=0
PRINT "Cam-Pick: " + EntityGetName$(pick), 0,20
ELSE
PRINT "No pick", 0,20
ENDIF
SHOWSCREEN
WEND