Loadmesh/entities and positioning.

Blitz3D Forums/Blitz3D Beginners Area/Loadmesh/entities and positioning.

Tobo(Posted 2009) [#1]
Dear all,

Scratching my bonce here, trying to fathom something out.

Using 3D World Studio, I have reduced the grid down to 1x1 unit and have created a small cube of 1x1x1 and position it at 0,0,0. I have then exported it to a .B3D format.

In Blitz, I have loaded the mesh and created a cube to sit at the same position (for error checking), so I can compare sizes.

Now, as I understand it, when you CREATECUBE() in Blitz, it creates it at -1,-1,-1 to 1,1,1; so I have reduced it via SCALEENTITY cube,.5,.5,.5 to give me a cube of 1x1x1 and positioned it at 0,0,0 with the following code.

Graphics3D 800,600,32,2

obj_pillar=LoadMesh("oneunitblock.b3d")

;light=CreateLight()
mycam=CreateCamera()

cube=CreateCube()
ScaleEntity cube,.5,.5,.5 

PositionEntity mycam,0,0,-5

PositionEntity cube,0,0,0

While Not KeyDown(1)

	Cls
	
	If KeyDown(200) Then MoveEntity(mycam,0,0,.2)
	If KeyDown(208) Then MoveEntity(mycam,0,0,-.2)
	If KeyDown(203) Then TurnEntity(mycam,0,1,0)
	If KeyDown(205) Then TurnEntity(mycam,0,-1,0)
	
	RenderWorld
	
	Text 0,0,"Hello World"
	
	Flip
	
Wend
End


However, when it displays the two blocks, it places one half inside the other, like this...



In short, why aren't they occupying exactly the same place at 0,0,0?

Hope the above makes sense.


Tobo


GfK(Posted 2009) [#2]
Looks like the axis of one cube is at its centre (correct), while the other cube's axis it at one of its corners (wrong).


Tobo(Posted 2009) [#3]
So with the createcube() command, which corner is its axis situated?

I always assumed that the bottom front left (all the minuses) was it!

Ahh - so when i place a cube at 0,0,0, its actually the centre that gets positioned there?

T


Warner(Posted 2009) [#4]
Yes, the center point is placed there. If you create your mesh in a 3d modeler, the center point would be the origin.


big10p(Posted 2009) [#5]
The origin of all blitz primitives is the centre of the mesh.


Tobo(Posted 2009) [#6]
Many thanks, guys.


T