Re: MP3D Engine Alpha 31
Posted: Sun Feb 10, 2013 5:42 pm
about pivoting only, i think in the sense it is used in Blitz3D , it is used in MP3D in the form of MP_MeshSetParent(Entity, Parent ).
in the example below the big cube are turning and the smaller will follow it, if we move the big cube up the smaller will follow it, if we press z the big will rotate slightly and the smaller will rotate the same. but scaling the parent does not scale the child, while it do this in Blitz3D, but rotating turning moving and may be more are the success relations between the parent and the follower in MP3D. yes in Blitz3D we can define pivot = CreatePivot() , then earth = CreateSphere(16,pivot)
and put the pivot inside the sun, and whatever it does the earth will follow. in my opinion it is the same as parenting at least from the amateur viewpoint.
the following code to demonstrate this idea are from MP_PlanetMond.pb example , i have caricatured it too much for the purpose of demo.
if you want the smaller cube to rotate around it self just uncomment line 48
in the example below the big cube are turning and the smaller will follow it, if we move the big cube up the smaller will follow it, if we press z the big will rotate slightly and the smaller will rotate the same. but scaling the parent does not scale the child, while it do this in Blitz3D, but rotating turning moving and may be more are the success relations between the parent and the follower in MP3D. yes in Blitz3D we can define pivot = CreatePivot() , then earth = CreateSphere(16,pivot)
and put the pivot inside the sun, and whatever it does the earth will follow. in my opinion it is the same as parenting at least from the amateur viewpoint.
the following code to demonstrate this idea are from MP_PlanetMond.pb example , i have caricatured it too much for the purpose of demo.
if you want the smaller cube to rotate around it self just uncomment line 48
Code: Select all
;example MP_PlanetMond.pb experiments version
MP_Graphics3D (640,480,0,3)
SetWindowTitle(0, "press z to rotate parent, press arrows to move parent") ; Setzt einen Fensternamen
camera=MP_CreateCamera()
light=MP_CreateLight(1)
Mesh = MP_CreateCube()
Mesh2 = MP_CreateCube()
If CreateImage(0, 255, 255)
MP_CreateImageColored(0,0,RGB($00,$F0,$00),RGB($00,$F0,$00),RGB($00,$00,$FF),RGB($00,$00,$ff)) ;
MP_EntitySetTexture (mesh, MP_ImageToTexture(0))
MP_CreateImageColored(0,0,RGB($F0,$00,$00),RGB($F0,$00,$00),RGB($00,$FF,$FF),RGB($00,$FF,$FF)) ;
MP_EntitySetTexture (mesh2, MP_ImageToTexture(0))
MP_CreateImageColored(0,0,RGB($00,$00,$F0),RGB($00,$00,$F0),RGB($FF,$00,$00),RGB($FF,$00,$00)) ;
MP_EntitySetTexture (mesh3, MP_ImageToTexture(0))
FreeImage(0)
EndIf
MP_PositionEntity (Mesh,0,0,4)
MP_RotateEntity(Mesh, 40, 40, 0)
MP_PositionEntity (Mesh2,0,0,1)
MP_ScaleEntity (Mesh2, 0.2, 0.2, 0.2 )
MP_MeshSetParent(Mesh2,Mesh)
y.f=0:x.f=0: rot.f=40
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow
If MP_KeyDown(#PB_Key_Up)
y + 0.02
ElseIf MP_KeyDown(#PB_Key_Down)
y - 0.02
ElseIf MP_KeyDown(#PB_Key_Right)
x=x+0.02
ElseIf MP_KeyDown(#PB_Key_Left)
x=x-0.02
ElseIf MP_KeyDown(#PB_Key_Z)
rot+1
MP_RotateEntity(Mesh, 40, rot, 0)
;MP_ScaleMesh(Mesh, 1, 0.9, 1) ; does not scale Mesh2
EndIf
MP_PositionEntity (Mesh,x,y,4)
MP_TurnEntity (Mesh,0.5,0,0)
;MP_TurnEntity (Mesh2,2,0,0)
MP_RenderWorld()
MP_Flip ()
Wend