DeltaYaw

Blitz3D Forums/Blitz3D Programming/DeltaYaw

Why overcomplicate it for the sake of creating a global pivot which is re-used. I'd imagine it's also quicker than what you have.

That said - this is less code ..

;; some geometry
Graphics3D 800,600,0,2
SetBuffer BackBuffer()
cam = CreateCamera()
CameraZoom cam,1.6
obj1 = CreateCone()
RotateMesh obj1, 90,0,0
ScaleMesh obj1,2,2,4
obj2 = CreateCube()
EntityColor obj1,255,0,0
EntityColor obj2,0,255,0
plane = CreatePlane()
EntityPickMode plane,2
PositionEntity plane, 0, -1, 0
PositionEntity cam,0,50,0
PointEntity cam,plane


While Not KeyHit(1)

 If CameraPick (cam,MouseX(),MouseY())
	
  PositionEntity obj2,PickedX(),PickedY(),PickedZ()

	TFormPoint PickedX() , 0 , PickedZ()  , 0 , obj1
	angle# = ATan2( TFormedZ() , TFormedX() ) - 90
	TurnEntity obj1,0, angle * .1,0, 1
			
 EndIf

 UpdateWorld()
 RenderWorld()
 Text 10,10,"X: " + EntityX(obj2)
 Text 10,30,"Y: " + EntityY(obj2)
 Text 10,50,"Z: " + EntityZ(obj2)
 Text 10,70,"ANGLE: " + angle
Text 10,80,"TX : "+TFormedX()
Text 10,90,"Tz : "+TFormedZ()

 Flip
 
 Wend

ClearWorld()
EndGraphics()
End


Stevie