1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. YellowWeedSeed

Beiträge von YellowWeedSeed

  • Irrlicht kamera mit Charakter richtig ausrichten

    • YellowWeedSeed
    • 3. Januar 2012 um 17:48

    Hey Leute,
    Ich hab vor eiin paar Tagen begonnen mich mit der AU3Irrlicht2 udf zu beschäftigen und jetzt will ich mich mal versuchen ein Spiel zu ersellen.
    Das klappt eigentlich auch aber hier kommtm mein Problem:
    Also Ich habe eine map und ein charakter,
    jetzt will ich das die kamera immer auf den char zeigt, also Rollenspielansicht.
    Das der CHarakter immer dort ist wo auch die kammera ist hab ich bereits, aber leider steht er immer in einem abstand zur kamera und dreht sich nicht mit.
    Ich benutze noch die FPSCamera da ich mit der normalen (_IrrAdCamera) noch nicht so ganz zurrecht komme.
    Aber wenn jemand es gleich mit einer _IrrAdCamera() machen könnte währe ich noch glücklicher ^^
    So genug geredet, hier ist mein script :

    €hab das mit der sicht hinbekommen und das auf mausbewegungen gedreht wird hier ist mein neues script:

    Spoiler anzeigen
    [autoit]

    #include <au3Irrlicht2.au3>
    #include <misc.au3>
    #include <math.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt("MustDeclareVars", True)
    HotKeySet("{ESC}", "_exit")

    [/autoit] [autoit][/autoit] [autoit]

    Func _exit()
    _IrrStop()
    Exit
    EndFunc ;==>_exit

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Dim $Camera
    Dim $NodeGround
    Dim $NodeBox
    Dim $aPosition[3] = [0, 100, 0]
    Dim $iDegree = 0
    Dim $iDistance = 300
    Dim $m_pos
    Dim $m_desk_w
    Dim $m_desk_h
    Dim $font
    Global $size[2]
    Global $a, $b

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _b()
    $b = MouseGetPos()
    Sleep(1)
    EndFunc ;==>_b

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $m_desk_h = @DesktopHeight
    $m_desk_w = @DesktopWidth

    [/autoit] [autoit][/autoit] [autoit]

    $size[0] = $m_desk_w
    $size[1] = $m_desk_h

    [/autoit] [autoit][/autoit] [autoit]

    _IrrStart($IRR_EDT_OPENGL, $size[0], $size[1], 32, $IRR_WINDOWED, _
    $IRR_SHADOWS, $IRR_IGNORE_EVENTS, $IRR_VERTICAL_SYNC_ON)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _IrrSetWindowCaption("Example 49: Collision in a Loaded Scene")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _IrrChangeWorkingDirectory("media")
    _IrrLoadScene("CollisionScene.irr")

    [/autoit] [autoit][/autoit] [autoit]

    $font = _IrrGetFont("media/bitmapfont.bmp")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Camera = _IrrAddCamera($aPosition[0] - 300, $aPosition[1] + 100, $aPosition[2], 0, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    $NodeGround = _IrrGetSceneNodeFromName("Ground")
    $NodeBox = _IrrGetSceneNodeFromName("Pillar")
    _IrrSetNodePosition($NodeBox, $aPosition[0], $aPosition[1], $aPosition[2])

    [/autoit] [autoit][/autoit] [autoit]

    _IrrHideMouse()
    MouseMove(0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    While _IrrRunning()
    $a = MouseGetPos()
    _IrrBeginScene(200, 200, 255)

    [/autoit] [autoit][/autoit] [autoit]

    ;_Irr2DFontDraw($font, $m_pos[0] & $m_pos[1], 4, 4, 250, 24)

    [/autoit] [autoit][/autoit] [autoit]

    _b()
    If $a[0] <> $b[0] Then
    If $a[0] > $b[0] Then
    $iDegree -= 1
    _IrrSetNodeRotation($NodeBox, 0, $iDegree, 0)
    ElseIf $a[0] < $b[0] Then
    $iDegree += 1
    _IrrSetNodeRotation($NodeBox, 0, $iDegree, 0)
    EndIf
    EndIf
    _IrrSetNodeRotation($NodeBox, 0, $iDegree, 0)

    [/autoit] [autoit][/autoit] [autoit]

    If _IsPressed(26) Then
    $aPosition[0] += Cos(_Radian($iDegree)) * 2
    $aPosition[2] -= Sin(_Radian($iDegree)) * 2
    _IrrSetNodePosition($NodeBox, $aPosition[0], $aPosition[1], $aPosition[2])
    EndIf
    _CalcCamera()

    [/autoit] [autoit][/autoit] [autoit]

    _IrrDrawScene()

    [/autoit] [autoit][/autoit] [autoit]

    _IrrEndScene()
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    _IrrStop()

    [/autoit] [autoit][/autoit] [autoit]

    Func _CalcCamera()
    Local $aPos[3]
    $aPos[0] = $aPosition[0] - Cos(_Radian($iDegree)) * $iDistance
    $aPos[2] = $aPosition[2] + Sin(_Radian($iDegree)) * $iDistance
    $aPos[1] = $aPosition[1] + 100
    _IrrSetNodePosition($Camera, $aPos[0], $aPos[1], $aPos[2])
    _IrrSetCameraTarget($Camera, $aPosition[0], $aPosition[1], $aPosition[2])
    EndFunc ;==>_CalcCamera

    [/autoit]


    Jetzt funktioniert es teilweise aber es ruckelt stark beim drehen, wer ne bessere Methode hat die sicht zu drehen bitte hier posten^^ am besten direkt am beispiel

    Das Alte Script:

    Spoiler anzeigen
    [autoit]


    ; ----------------------------------------------------------------------------
    ; Example 13: Camera Position
    ; This example creates a map for you to move around and displays the current
    ; position of the camera and its rotation on the screen
    ; ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; ////////////////////////////////////////////////////////////////////////////
    ; Includes for extension libraries
    #include "au3Irrlicht2.au3"
    Opt("MustDeclareVars", True)
    HotKeySet("{ESC}", "_exit")

    [/autoit] [autoit][/autoit] [autoit]

    Func _exit()
    _IrrStop()
    Exit
    EndFunc ;==>_exit

    [/autoit] [autoit][/autoit] [autoit]

    ; ////////////////////////////////////////////////////////////////////////////
    ; global variables

    [/autoit] [autoit][/autoit] [autoit]

    ; irrlicht objects
    Dim $BSPMesh ; irr_mesh
    Dim $BSPNode ; irr_node
    Dim $Camera ; irr_camera
    Dim $BitmapFont ; irr_font
    Dim $X ; Single
    Dim $Y ; Single
    Dim $Z ; Single
    Dim $metrics ; String
    Dim $a_vector3df[3]
    Dim $MapCollision ;
    Global $grav[3], $rad[3], $pos[3], $tar[3], $char[3], $pos1[3]
    Global $mesh1, $texture, $node1, $frame, $posit

    [/autoit] [autoit][/autoit] [autoit]

    ; ////////////////////////////////////////////////////////////////////////////

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; -----------------------------------------------------------------------------
    ; start the irrlicht interface
    _IrrStart($IRR_EDT_DIRECT3D9, 800, 600, $IRR_BITS_PER_PIXEL_32, _
    $IRR_WINDOWED, $IRR_NO_SHADOWS, $IRR_IGNORE_EVENTS, $IRR_VERTICAL_SYNC_ON)
    ; set the window caption
    _IrrSetWindowCaption("Example 13: Camera Position and Rotation")

    [/autoit] [autoit][/autoit] [autoit]

    ; create a frist person perspective camera that can be controlled with mouse
    ; and cursor keys

    [/autoit] [autoit][/autoit] [autoit]

    $pos[0] = 1750 ;x
    $pos[1] = 144 ;y
    $pos[2] = 1369 ;z

    [/autoit] [autoit][/autoit] [autoit]

    $tar[0] = 1175;x
    $tar[1] = 130;y
    $tar[2] = 1364;z

    [/autoit] [autoit][/autoit] [autoit]

    $Camera = _IrrAddFpsCamera()
    ;$Camera = _IrrAddCamera($pos[0], $pos[1], $pos[2], $tar[0], $tar[1], $tar[2])
    ;_IrrSetNodePosition($node1, $tar[0], $tar[1], $tar[2])
    ;$Camera = _IrrAddFpsCamera()

    [/autoit] [autoit][/autoit] [autoit]

    ; reposition and rotate the camera to look at a nice part of the map
    _IrrSetNodePosition($Camera, 1750, 149, 1369)
    _IrrSetNodeRotation($Camera, 4, -461.63, 0)

    [/autoit] [autoit][/autoit] [autoit]

    ; load a Quake 3 BSP Map from a zip archive
    _IrrAddZipFile("media/map-20kdm2.pk3", $IRR_IGNORE_CASE, $IRR_IGNORE_PATHS)
    $BSPMesh = _IrrGetMesh("20kdm2.bsp")
    $BSPNode = _IrrAddMeshToSceneAsOcttree($BSPMesh)

    [/autoit] [autoit][/autoit] [autoit]

    $rad[0] = 20;x rechts
    $rad[1] = 30;y oben
    $rad[2] = 20;z hinten

    [/autoit] [autoit][/autoit] [autoit]

    ;Gravitation => wie stark nach x, y, z ,zieht
    $grav[0] = 0;x
    $grav[1] = -9.8;y
    $grav[2] = 0;z

    [/autoit] [autoit][/autoit] [autoit]

    $MapCollision = _IrrGetCollisionGroupFromComplexMesh($BSPMesh, $BSPNode)
    _IrrAddCollisionAnimator($MapCollision, $Camera, $rad[0], $rad[1], $rad[2], $grav[0], $grav[1], $grav[2], 0.0, 50.0, 0.0)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $char[0] = 1
    $char[1] = 2
    $char[2] = 3

    [/autoit] [autoit][/autoit] [autoit]

    $mesh1 = _IrrGetMesh("media/zumlin.md2")
    $texture = _IrrGetTexture("media/zumlin.pcx")

    [/autoit] [autoit][/autoit] [autoit]

    $node1 = _IrrAddMeshToScene($mesh1)
    _IrrSetNodeMaterialTexture($node1, $texture, 0)
    _IrrSetNodeMaterialFlag($node1, $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrPlayNodeMD2Animation($node1, $IRR_EMAT_RUN)
    _IrrSetNodeAnimationSpeed($node1, 30)

    [/autoit] [autoit][/autoit] [autoit]

    $BitmapFont = _IrrGetFont("media/bitmapfont.bmp")

    [/autoit] [autoit][/autoit] [autoit]

    ; we also hide the mouse pointer to see the view better
    _IrrHideMouse()

    [/autoit] [autoit][/autoit] [autoit]

    ; -----------------------------------------------------------------------------
    ; while the irrlicht environment is still running
    While _IrrRunning()
    ; begin the scene, erasing the canvas with sky-blue before rendering
    _IrrBeginScene(50, 50, 50)

    [/autoit] [autoit][/autoit] [autoit]

    ; draw the scene
    _IrrDrawScene()

    [/autoit] [autoit][/autoit] [autoit]

    $posit = _IrrGetNodePosition($Camera)
    $pos1[0] = $posit[0] - 100
    $pos1[1] = $posit[1] - 45
    $pos1[2] = $posit[2]
    _IrrSetNodePosition($node1, $pos1[0], $pos1[1], $pos1[2])

    [/autoit] [autoit][/autoit] [autoit]

    ; get the position of the camera into the supplied array
    $a_vector3df = _IrrGetNodePosition($Camera)

    [/autoit] [autoit][/autoit] [autoit]

    ; create a wide string with a list of the positions in
    $metrics = "POSITION " & Int($a_vector3df[0]) & " " & Int($a_vector3df[1]) & " " & Int($a_vector3df[2]) & " "

    [/autoit] [autoit][/autoit] [autoit]

    ; draw this position information to the screen
    _Irr2DFontDraw($BitmapFont, $metrics, 4, 4, 250, 24)

    [/autoit] [autoit][/autoit] [autoit]

    ; get the rotation of the camera into the supplied array
    $a_vector3df = _IrrGetNodeRotation($Camera)

    [/autoit] [autoit][/autoit] [autoit]

    ; create a wide string with a list of the rotations in
    $metrics = "ROTATION " & Int($a_vector3df[0]) & " " & Int($a_vector3df[1]) & " " & Int($a_vector3df[2]) & " "

    [/autoit] [autoit][/autoit] [autoit]

    ; draw this position information to the screen
    _Irr2DFontDraw($BitmapFont, $metrics, 4, 32, 250, 52)

    [/autoit] [autoit][/autoit] [autoit]

    ; end drawing the scene and display it
    _IrrEndScene()
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    ; -----------------------------------------------------------------------------
    ; Stop the irrlicht engine and release resources
    _IrrStop()

    [/autoit]

    Ich hab noch ein Problem entdeckt:
    Also ich wollte den Collision punkt dem zumlin modell zuweisen wenn ich jetzt aber bei _IrrAddCollisionAnimator anstatt

    Spoiler anzeigen

    ($MapCollision, $Camera, $rad[0], $rad[1], $rad[2], $grav[0], $grav[1], $grav[2], 0.0, 50.0, 0.0)

    das einfüge:

    Spoiler anzeigen

    ($MapCollision, $mesh1, $rad[0], $rad[1], $rad[2], $grav[0], $grav[1], $grav[2], 0.0, 50.0, 0.0)

    kommt dieser Fehler: [Blockierte Grafik: http://www.bilder-upload.eu/thumb/42af97-1325619401.png]

  • Tutorial Für Irrlicht

    • YellowWeedSeed
    • 1. Januar 2012 um 23:22

    Ich weiß das Thema ist schon bissl älter, aber ich hab es mir gerade durchgelesen und fand es eigentlich sehr gut. Dabei bin ich auf einige Fehler in deinem Tut gestoßen :) wenn du skype, Icq hast pn mich mal, denn es währ bisschen viel hier zu posten.

    mfg YellowWeedSeed

    Ich hoffe mal das dass jetzt nicht als pushen von alten threads gilt,
    wenn doch tuts mir leid aber es sind doch auch teilweise fehler im script dabei

  • auslesen wie viele Dateien in einem Ordner sind mit Namen Für Combobox

    • YellowWeedSeed
    • 20. Dezember 2011 um 17:36

    aso sry bin wie man sieht neu hier :rolleyes:

  • auslesen wie viele Dateien in einem Ordner sind mit Namen Für Combobox

    • YellowWeedSeed
    • 19. Dezember 2011 um 17:20

    ok danke ich habs verstanden

    Ihr habt mir sehr geholfen :)

    *kann geclosed werden

  • auslesen wie viele Dateien in einem Ordner sind mit Namen Für Combobox

    • YellowWeedSeed
    • 19. Dezember 2011 um 17:06

    vielen vielen dank euch beiden, es funktioniert super aber leider kapiere ich nicht so wirklich wie das jetzt funktioniert.

    Es währe net wenn mir das mal jemand bei der 1 Antwort sagen könnte ^^

    (Ich will ja was daraus lernen :D )

    Mfg YellowWeedSeed

  • auslesen wie viele Dateien in einem Ordner sind mit Namen Für Combobox

    • YellowWeedSeed
    • 18. Dezember 2011 um 21:37

    Hey Com,

    Ich hätte ein Problem:

    Also ich möchte das alle dateien aus einem Ordner in einer combobox stehen (GUI)

    Ich weiß dafür gibt es _FileListToArray, aber ich weiß nicht wie ich das dann in eine Combobox bekommen könnte.

    Ich hoffe ihr habt einen guten Vorschlag für mich und bedanke mich schonmal für eure Hilfe. :)


    Mfg YellowWeedSeed

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™