Pivot Point centering

Blitz3D Forums/Blitz3D Programming/Pivot Point centering

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

you need to use the positionmesh command to move the mesh to it's pivot. I think that Ross C's suggestion should work.

Look at this chunk of code:

Graphics3D 640,380,0,2
SetBuffer BackBuffer()

cube = CreateCube()
PositionMesh cube,5,5,5

cam = CreateCamera()
PositionEntity cam,0,0,-20

While Not KeyHit(1)
	TurnEntity cube,1,1,1

	If KeyHit (57) Then FitMesh cube,-1,-1,-1,2,2,2 

	UpdateWorld()
	RenderWorld()
	Text 10,10,"press space to center cube pivot"
	Flip
Wend
End 



notice how the cube does not rotate around it's center. The positionMESH command moves the mesh but not the pivot. To fix a mis-aligned pivot, you should be able to:
1. position mesh at 0,0,0 (This will put the pivot at 0,0,0)
2. use fitmesh to place the mesh around the 0,0,0, coordinates
3. now use positionmesh to put the object back where it was, except now the pivot should be correct.