Sorry ... jusy through it together ...
Try this ... note I replaced createpivot with createsphere() so you can see it.
Graphics3D 640,480,16,1
Global cube = CreateCube()
ScaleMesh cube, 10,10,10
EntityColor cube, 255,0,0
Global camera = CreateCamera()
PositionEntity camera, 0,0,-50
CornerPivot( cube )
While Not KeyDown(1)
TurnEntity cube, 1, 0, 1
RenderWorld()
Flip
Wend
Function CornerPivot( Mesh , Loc = True )
Mw# = MeshWidth( mesh )
Mh# = MeshHeight( mesh )
Md# = MeshDepth( mesh )
;center mesh
FitMesh mesh , -Mw*.5, -Mh*.5 , -Md*.5 , Mw, Mh, Md
For x# = -.5 To .5 Step 1
For y# = -.5 To .5 Step 1
For z# = - .5 To .5 Step 1
If Loc ; local placement
pivot = CreateSphere( 4, mesh ) ;Pivot( mesh )
PositionEntity pivot, x*Mw, y*Mh, z*Md
Else
TFormPoint x*Mw, y*Mh, z*Md, mesh, 0
pivot = CreatePivot()
PositionEntity pivot, TFormedX(), TFormedY(), TFormedZ()
EndIf
Next
Next
Next
End Function
|