Oui merci j'ai bien avancer dans mon projet il ne manque a ma base que les collision et l'apesanteur tous ça grâce a Dreamotion (J'utilise un des exemple pour le transformer en se que je veut). Aussi j'ai un problème de rotation avec un personnage :
Code : Tout sélectionner
; ------------------------------------------------------------
; DreaMotion3D
;
; Exemple : AnimX
; Historique :
; 18/09/06 00:00 DreaMotion3D Team
; 10/02/07 19:16 TMyke
;
; ------------------------------------------------------------
; Include files
IncludePath "Include\" : IncludeFile "dreamotion3d.pbi"
;EnableExplicit
Declare FrameFind( *pframe.D3DXFRAME , *frame.D3DXFRAME)
; Globales
Global anglex.f, angley.f, flagXDown.w
Global mox.f, omx.f, moy.l, omy.l
Global *camera.CEntity
Global *land.CEntity
Global Dim *tiny.CAnimX(30)
Global *cube.CMesh
Global *font.CFont
Global val.l,Quit.b
Global i.l, flag.l
Global tab.l=0, *tFrame.D3DXFRAME
DM_InitPhysic()
; Init PB modules
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
End
EndIf
; set graphic window 3D
*app = DM_Graphics3D(800,600, 32, 0, 1)
;load font
*font = DM_LoadFont( "Tahoma",9 , 0)
DM_TextColor (*font, 198,198,198,255)
; change directory for media
SetCurrentDirectory("media/")
; Set lights
DM_AmbientLight(150, 150, 150)
DM_CreateLight(3)
; ---------------------------------------
; meshs
; ---------------------------------------
; Charge le sol
*land = DM_LoadMesh("land.x")
*tiny(0) = DM_LoadAnimMesh("bones_all.x")
DM_ScaleEntity(*tiny(0), 13,13,13)
DM_AnimateSpeed(*tiny(0), 0.01)
DM_MoveEntity(*tiny(0), -50,10,-300.0)
DM_RotateEntity(*tiny(0), 0,20,0)
;Debug DM_AnimFrameName(*tiny(0)\ g_pFrameRoot)
;Debug "-------"
;FrameFind( *tiny(0)\ g_pFrameRoot, #Null)
; ---------------------------------------
; create camera
; ---------------------------------------
*camera = DM_CreateCamera()
DM_MoveEntity(*camera, -14,10,-200) ; valeur initiale -34,25,-250 : nouvelle configuration -14,10,-200
DM_TurnEntity(*camera, 0,200,0)
DM_CameraClsColor(*camera, 125, 125, 125)
;if full screen...
;change_curseur( #IDC_ARROW )
; ---------------------------------------
; main loop
; ---------------------------------------
Repeat
ExamineKeyboard()
ExamineMouse()
ShowCursor_(1)
; if Escape Key, exit
If KeyboardReleased(#PB_Key_Escape) Or WindowEvent()=#PB_Event_CloseWindow
Quit=1
EndIf
; change animation on Tiny 5
If KeyboardReleased(#PB_Key_Up)
DM_AnimateIndex(*tiny(0), 0)
EndIf
If KeyboardPushed(#PB_Key_Up)
DM_AnimateIndex(*tiny(0), 1)
EndIf
If KeyboardReleased(#PB_Key_Down)
DM_AnimateIndex(*tiny(0), 0)
EndIf
If KeyboardPushed(#PB_Key_Down)
DM_AnimateIndex(*tiny(0), 1)
EndIf
If KeyboardPushed(#PB_Key_Down)
DM_MoveEntity(*tiny(0), 0,0,4)
EndIf
If KeyboardPushed(#PB_Key_Up)
DM_MoveEntity(*tiny(0), 0,0,-4)
EndIf
[color=red] If KeyboardPushed(#PB_Key_Right)
DM_RotateEntity(*tiny(0), 0,4000,0)
EndIf
If KeyboardPushed(#PB_Key_Left)
DM_RotateEntity(*tiny(0), 0,-4000,0)
EndIf[/color]
If KeyboardReleased(#PB_Key_B) : flag=11 : EndIf
If KeyboardReleased(#PB_Key_N) : flag=0 : EndIf
; move camera with dir key and mouse (left click)
If KeyboardPushed(#PB_Key_Up)
DM_MoveEntity(*camera, 0,0,4)
DM_PointEntity(*camera, *tiny(0))
ElseIf KeyboardPushed(#PB_Key_Down)
DM_MoveEntity(*camera, 0,0,-4)
DM_PointEntity(*camera, *tiny(0))
EndIf
If KeyboardPushed(#PB_Key_Left)
DM_MoveEntity(*camera, -4,0,0.16)
DM_PointEntity(*camera, *tiny(0))
ElseIf KeyboardPushed(#PB_Key_Right)
DM_MoveEntity(*camera, 4,0,0.16)
DM_PointEntity(*camera, *tiny(0))
EndIf
If MouseButton(#PB_MouseButton_Left)
If flagXDown=0
omx = MouseX()
omy = MouseY()
flagXDown=11
Else
moy = MouseY()-omy
angley=(0)
omy= MouseY()
mox = MouseX()-omx
anglex=(mox/5.0)
omx= MouseX()
DM_TurnEntity(*tiny(0), angley,anglex,0)
DM_TurnEntity(*camera, angley,anglex,0)
EndIf
Else
flagXDown=0
EndIf
DM_UpdatePhysic()
; ---------------
; Render
; ---------------
If flag=0 : DM_UpdateWorld() : EndIf
DM_BeginScene()
DM_RenderWorld(*camera)
; draw texte
DM_DrawText(*font, 10, 15, "FPS : "+Str(DM_FPS()))
DM_DrawText(*font, 10, 30, "F1/F2/F3/F4 : index of animate's tiny1")
DM_EndScene()
Until Quit=1
DM_ClearGraphics()
End
Procedure FrameFind( *pframe.D3DXFRAME , *frame.D3DXFRAME)
Protected a$
a$=Space(tab)
Repeat
*frame = DM_AnimateGetChild(*tiny(0), *pframe, *frame)
If *frame
Debug a$+DM_AnimFrameName(*frame)
tab+3
FrameFind(*frame, #Null)
EndIf
Until *frame=#Null
tab-3
EndProcedure
; IDE Options = PureBasic v4.00 (Windows - x86)
; CursorPosition = 69
; FirstLine = 53
Je voudrait que quand j'appuie sur la touche droite (ou gauche) il tourne sur lui même comme dans les jeux pour voir le personnage or tous ce qu'il fait c'est un angle de je ne c'est combien de degré . Aidé moi s'il vous plait. Au faite après quand j'aurai fini tout ceci, et bien je pourrait fait mon éditeur de carte 3d et je vous le donnerai et vous ferez un avis dessus d'accord ?