Diese MD2 Animation bringt mich noch um den Verstand...

Fragen zu Grafik- & Soundproblemen und zur Spieleprogrammierung haben hier ihren Platz.
Benutzeravatar
Ground0
Beiträge: 318
Registriert: 05.02.2005 02:09
Wohnort: Stilli, Schweiz
Kontaktdaten:

Diese MD2 Animation bringt mich noch um den Verstand...

Beitrag von Ground0 »

Hallo

Also habe folgende Routine, jetzt tut dann alles so wie es solte bloss die MD2 Animationen machen noch was sie wollen ^.^ eigentlich solte diese ("t***e") am Anfang stehen bleiben, aber sie tuts nicht die bewegt sich einfach weiter !!!

Hier der Code:

Code: Alles auswählen

;; //////////////////////////////////////////////////////////////////////////// 
;; Includes For extension libraries 
XIncludeFile "IrrlichtWrapper.pbi" 
;; //////////////////////////////////////////////////////////////////////////// 
;; Init the DLL 
InitIrrlichtWrapperDll()  

IrrStart( #IRR_EDT_DIRECT3D9, 800, 600, #IRR_WINDOWED, #IRR_SHADOWS, #IRR_CAPTURE_EVENTS)  
;; //////////////////////////////////////////////////////////////////////////// 
;; Einrichten der Nodes
*Figur.irr_mesh
*Figur_Text.irr_texture
*Figur_Node.irr_node
*Welt.irr_mesh
*MeshTexture.irr_texture
*SceneNode.irr_node
*OurCamera.irr_camera
*Sky.irr_texture
*Sky_Dome.irr_node
*MouseEvent.IRR_MOUSE_EVENT
*KeyEvent.IRR_KEY_EVENT
*Licht.irr_node
;; //////////////////////////////////////////////////////////////////////////// 
;; Mesh zur Welt hinzufügen.
*Figur = IrrGetMesh("Figuren\Sydney\Sydney.md2")
*Figur_Text = IrrGetTexture("Figuren\Sydney\Sydney24.bmp")
*Figur_Node = IrrAddMeshToScene(*Figur)
IrrSetNodeMaterialTexture( *Figur_Node, *Figur_Text, 0 )
IrrSetNodeMaterialFlag( *Figur_Node, #IRR_EMF_LIGHTING, #IRR_ON )
IrrSetNodeAnimationSpeed( *Figur_Node, 0 )
IrrPlayNodeMD2Animation(*Figur_Node, 0) 

*Welt = IrrGetMesh("Welten\Ankunft\Welt.x")
*SceneNode = IrrAddMeshToScene(*Welt)
IrrSetNodeScale(*SceneNode, 5,5,5 )
;IrrSetNodeMaterialFlag( *SceneNode, #IRR_EMF_LIGHTING, #IRR_ON )
;; //////////////////////////////////////////////////////////////////////////// 
;; Kolliaions Gruppe 

*MapCollision = IrrGetCollisionGroupFromComplexMesh( *Welt, *SceneNode )
IrrSetAmbientLight(0.1,0.1,0.1) 

*Licht=IrrAddLight(0,0,0, 255,255,255, 1000) 
IrrSetShadowColor( 128, 0, 0, 0 )
;; //////////////////////////////////////////////////////////////////////////// 
;; Konfiguration des Nebels
;IrrSetNodeMaterialFlag( *SceneNode, #IRR_EMF_FOG_ENABLE, #IRR_ON )
;IrrSetNodeMaterialFlag( *Sky_Dome, #IRR_EMF_FOG_ENABLE, #IRR_ON )
;IrrSetNodeMaterialFlag( *Welt, #IRR_EMF_FOG_ENABLE, #IRR_ON )
;IrrSetFog ( 240,255,255, #IRR_EXPONENTIAL_FOG, 0.0,7000.0, 0.9 )

;; //////////////////////////////////////////////////////////////////////////// 
;; Konfiguration des Himmels
*Sky = IrrGetTexture("Welten\Ankunft\Sky.jpg")
*Sky_Dome = IrrAddSkyDomeToScene( *Sky, 10, 10, 1, 2 )
IrrAddNodeShadow(*SceneNode) 
IrrAddNodeShadow(*Figur_Node) 
;; //////////////////////////////////////////////////////////////////////////// 
;; Konfiguration der Kamera.
*OurCamera = IrrAddCamera(-200,600,0,-201,599,0)
;IrrSetNodePosition(*OurCamera, -200,600,0)
IrrSetNodePosition(*Figur_Node, -200,600,0)
IrrSetCameraClipDistance ( *OurCamera, 20000 ) 
*CameraNode = *OurCamera
*ret = IrrAddCollisionAnimator( *MapCollision, *Figur_Node, 30.0,30.0,30.0, 0.0,-3.0,0.0, -10.0,0.0,0.0 )
Abstand.f = 70
Empfindlichkeit = 2
Speed=20
Delay(1000)
While IrrRunning() 
  ;; //////////////////////////////////////////////////////////////////////////// 
  ;; TastaturSteuerung
  While IrrKeyEventAvailable()
    
    ; read the key event out. the key event has three parameters the key
    ; scan code, the direction of the key and flags that indicate whether
    ; the control key or the shift keys were also pressed
    *KeyEvent = IrrReadKeyEvent()

     If *KeyEvent\direction = #IRR_KEY_DOWN 
        ; arbitrate based on the key that was pressed
        Select *KeyEvent\key
          Case #IRR_KEY_ESCAPE  ;Escape Quits
             IrrStop()
             End
             
          Case 37     ; Left Arrow
              ; if the key is going down
              If *KeyEvent\direction = #IRR_KEY_DOWN 
                  XStrafe = Speed
              Else
                  If XStrafe = Speed
                      XStrafe = 0
                  EndIf
              EndIf
  
          Case 40     ; Up Arrow
              ; if the key is going down
              If *KeyEvent\direction = #IRR_KEY_DOWN
                  ZStrafe = Speed
              Else
                  If ZStrafe = Speed
                      ZStrafe = 0
                  EndIf
              EndIf
                  
          Case 39     ; Right Arrow
              ; if the key is going down
              If *KeyEvent\direction = #IRR_KEY_DOWN
                  XStrafe = -Speed
              Else
                  If XStrafe = -Speed
                      XStrafe = 0
                  EndIf
              EndIf
                  
          Case 38     ; Down Arrow
              ; if the key is going down
              If *KeyEvent\direction = #IRR_KEY_DOWN
                  ZStrafe = -Speed
              Else
                  If ZStrafe = -Speed
                      ZStrafe = 0
                  EndIf
              EndIf
        EndSelect
     EndIf
  Wend
  If ZStrafe<>0 Or XStrafe<>0    
    IrrGetNodeRotation(*Figur_Node,@Xrot.f,@Yrot.f,@Zrot.f)
    IrrSetNodeRotation(*Figur_Node,Xrot,Yrot-XStrafe,Zrot);

    ;IrrGetNodePosition(*Figur_Node,@Xpos.f,@YPos.f,@ZPos.f)
    ;IrrSetNodePosition(*Figur_Node,Xpos+ZStrafe,YPos,ZPos);
    IrrMoveNodeForward(*Figur_Node,-ZStrafe/4);
    ;IrrGetNodeRotation(*CameraNode,@Xrot.f,@Yrot.f,@Zrot.f)
    ;IrrSetNodeRotation(*CameraNode,Xrot,Yrot-XStrafe,Zrot); 
    ZStrafe=0
    XStrafe=0
    Anim=20
    AnimSt=1
    AnimS=1
  EndIf
    
  ;; //////////////////////////////////////////////////////////////////////////// 
  ;; Maussteuerung
  While IrrMouseEventAvailable()
    *MouseEvent = IrrReadMouseEvent()
        

    If *MouseEvent\action = #IRR_EMIE_MOUSE_WHEEL
    ;Debug(*MouseEvent\Wheel)
      If Abstand>50 And Abstand<1150
        Abstand = Abstand + (*MouseEvent\Wheel*Empfindlichkeit)
      ElseIf Abstand<50 Or Abstand=50
        Abstand=51
      ElseIf Abstand>1150 Or Abstand=1150
        Abstand=1149
      EndIf
		EndIf
	Wend  
  ;; //////////////////////////////////////////////////////////////////////////// 
  ;; Kamera ansichtssteuerungsroutine
  IrrGetNodePosition(*Figur_Node,@Xpos.f,@YPos.f,@ZPos.f)
  ;Debug(Str(Xpos)+","+Str(YPos)+","+Str(ZPos))
  IrrSetNodePosition(*OurCamera, XPos+Abstand,YPos+Abstand,ZPos)
  IrrSetCameraTarget(*OurCamera, XPos,YPos,ZPos)
  ; begin the scene, erasing the canvas to white before rendering 
  IrrBeginScene( 255,255,255 )  
  ; draw the Graphical User Interface 

  IrrDrawScene()  
  ; end drawing the scene and render it 

  IrrEndScene() 
  If Anim=0
    
    If AnimStop=1
      IrrPlayNodeMD2Animation(*Figur_Node, 0)    
      IrrSetNodeAnimationSpeed( *Figur_Node, 0 )
      AnimStop=0
    EndIf
  Else
    If AnimS=1
      Anim=Anim-1
      AnimS=0
      If AnimSt=1
        IrrPlayNodeMD2Animation(*Figur_Node, 1)
      IrrSetNodeAnimationSpeed( *Figur_Node, 20 )
        Debug("René hat scheisse gebaut")
        AnimSt=0
      EndIf


    Else
      Anim=Anim-1
      If Anim=0
        AnimStop=1
      EndIf  
    EndIf
  EndIf
  Delay(1)

Wend  
; ----------------------------------------------------------------------------- 
; Stop the irrlicht engine and release resources 
IrrStop()
Hat jemand noch Ideen ?

Gruss Ground0

PS:ISt kraut und rüben Programmiert Ok, aber ich werds dan fürs Tut noch in seine Einzelstücke Demontieren :allright:

Und wens das falsche Unterforum ist verschieben...
lmon Monitoring Service inkl. Clients
lweb Multi-Threaded Webserver
lbup-server Backup Server applikation
lmanager ERP Applikation.
Benutzeravatar
Zaphod
Beiträge: 2875
Registriert: 29.08.2004 00:40

Beitrag von Zaphod »

Das ist ein bekannter BUG in der QUALITÄTS-Ogre implementierung von PB.

Da ist wohl die einzige Lösung im MD2 File eine 1Frame Animation anzulegen die nichts macht.

Habe es aber nicht ausprobiert.

Meistens haben die MD2 Files aber auch eine richtige Idle animation die abgespielt werden soll, wenn die Figur grade nichts macht, dann steht sie nur da und guckt sich um oder bohrt in der Nase... die könntest du dann also stattdessen abspielen lassen, da macht es ja nichts wenn sie nicht aufhört.
Benutzeravatar
Ground0
Beiträge: 318
Registriert: 05.02.2005 02:09
Wohnort: Stilli, Schweiz
Kontaktdaten:

Beitrag von Ground0 »

Hallo Zaphod,

Es ist die Irrlicht Engine.

Gruss G0
lmon Monitoring Service inkl. Clients
lweb Multi-Threaded Webserver
lbup-server Backup Server applikation
lmanager ERP Applikation.
Benutzeravatar
Zaphod
Beiträge: 2875
Registriert: 29.08.2004 00:40

Beitrag von Zaphod »

Hehe, hätte ich mal in den Quellcode schauen sollen... naja, die Ogre implementierung hat das selbe Problem.
Vieleicht gibt es ja in der Irrlicht engine einen Befehl zum stoppen der Funktioniert.
Benutzeravatar
Ground0
Beiträge: 318
Registriert: 05.02.2005 02:09
Wohnort: Stilli, Schweiz
Kontaktdaten:

Beitrag von Ground0 »

Hehe fast peinlich...

Code: Alles auswählen

IrrSetNodeAnimationSpeed( *Figur_Node, 0 )
IrrPlayNodeMD2Animation(*Figur_Node, 0) 
Umdrehen und es tut wie es soll
lmon Monitoring Service inkl. Clients
lweb Multi-Threaded Webserver
lbup-server Backup Server applikation
lmanager ERP Applikation.
Antworten