Pivot and mesh
Blitz3D Forums/Blitz3D Programming/Pivot and mesh
| ||
Hi all, Can someone please tell me what the CreatePivot is used for. I have taken some code from the castle demo and see it has a createpivot() but not sure why! You can rotate meshes without a pivot, so why is it created? In my version of the code, i don't use the CopyEntity so do i need to somehow associate the mesh with the pivot? Function CreatePlayer.Soldier_t( x#,y#,z# ) s.Soldier_t = New Soldier_t s\entity = CreatePivot() s\model = LoadMesh("Soldier.x") s\player_y = y ScaleEntity s\model ,0.001,0.001,0.001 PositionEntity s\entity, x, y, z EntityType s\entity, TYPE_PLAYER EntityRadius s\entity, 1.5 ResetEntity s\entity Return s End Function thanks all |
| ||
A Pivot is just a 3d object with no mesh. It is for auxiliary process. You can move it, rotate it, etc... For example you can set a pivot to be an invisible point where all your players must go, so just checking the distance with the pivot you know when has been reached... The utilities are infinite... |
| ||
Here is a very simple example of how/why it is useful:Graphics3D 640,480 SetBuffer BackBuffer() piv = CreatePivot() box = CreateCube(piv) MoveEntity box,6,0,0 cam = CreateCamera() MoveEntity cam,0,0,-10 While Not KeyDown(1) TurnEntity piv,0,0, 1 RenderWorld Flip Wend End |
| ||
Thanks Guys, I think that makes sense now. I'll add it to my project tonight. |