kaotkbliss Posted October 24, 2010 Share Posted October 24, 2010 Ok, messing with your example I found that if you use While 1 instead of While _IrrRunning() The animations won't play. So theoretically, if I change from While 1 to the latter, my animations should work. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
linus Posted October 24, 2010 Share Posted October 24, 2010 Ok, messing with your example I found that if you use While 1 instead of While _IrrRunning() The animations won't play.Stupid at the first look (returned true should be same as your 1, right ...), so I consulted Irrlicht documentation which makes it clear. _IrrRunning() uses this: virtual bool irr::IrrlichtDevice::run ( ) [pure virtual] Runs the device. Also increments the virtual timer by calling ITimer::tick();. You can prevent this by calling ITimer::stop(); before and ITimer::start() after calling IrrlichtDevice::run(). Returns false if device wants to be deleted. Use it in this way: while(device->run()) { // draw everything here } If you want the device to do nothing if the window is inactive (recommended), use the slightly enhanced code shown at isWindowActive(). Quiet interesting because seems to be a way to freeze a complete scene (including active animators etc.) and update it by hand: while _IrrIsWindowActive() if needed _IrrIsRunning() ; conditinal run of device including update of internal timer doSomething Wend Mental note to myself: check and add something about this to help file Link to comment Share on other sites More sharing options...
BiliyomKi Posted October 26, 2010 Share Posted October 26, 2010 (edited) I dont know why i posting this but its can be -a little- example V2:expandcollapse popup;------------------------------------------ ;WSAD : Move ;Q : Camera Position + ;E ; Camera Position - ;Left Click ; Attack ;Space ; Jump ;------------------------------------------ #include "..\au3Irrlicht2.au3" #include <Misc.au3> HotKeySet("{ESC}", "_exit") Func _exit() _IrrStop() Exit EndFunc ;==>_exit ;VARIABLES Dim $Terrain, $TerrainNode, $TerrainTexture0, $TerrainTexture1, $Camera, $CameraNode, $heightMap, $colorMap Dim $vector3df[3], $Font, $Cloud, $aCloud, $framerate, $fpsString, $SkyBox, $CameraNode, $CloudTexture Dim $CloudNode, $Zumlin, $MeshTexture, $SceneNode, $x, $y, $vect[3], $Mert, $ret, $pKeyEvent, $keyCode Dim $pMouseEvent, $POS[3], $metrics, $XStrafe, $ZStrafe, $SPIN, $TILT, $vX[3], $vY[3], $vZ[3], $MX, $MY, $jumptimerr = "NOT JUMPED YET" Dim $zX = 342.8, $zY = 502.7, $zZ = 113.9, $oX, $oY, $oZ, $selector, $ellipsoidPosition[3], $ellipsoidRadius[3] Dim $velocity[3], $gravity[3], $outPosition[3], $outHitPosition[3], $outFalling, $Mert2, $hareketli, $attacktimer Dim $attacktimerr = "NOT ATTACKED YET", $v, $yazi, $atakbilgi, $pMouseEvent, $POS[3], $metrics, $XStrafe, $ZStrafe, $SPIN, $TILT, $aa Dim $TILE_SIZE = 128, $ayazi, $byazi, $RotationAngle = 0, $firstrun = True, $poss = -150, $TerrainNode = $Terrain,$jump = 0 ;LETS START _IrrStart($IRR_EDT_DIRECT3D9, @DesktopWidth - 50, @DesktopHeight - 100, $IRR_BITS_PER_PIXEL_32, $IRR_WINDOWED, $IRR_SHADOWS, $IRR_IGNORE_EVENTS, $IRR_VERTICAL_SYNC_ON) ;SKYBOX $SkyBox = _IrrAddSkyBoxToScene( _ _IrrGetTexture("../media/irrlicht2_up.jpg"), _ _IrrGetTexture("../media/irrlicht2_dn.jpg"), _ _IrrGetTexture("../media/irrlicht2_rt.jpg"), _ _IrrGetTexture("../media/irrlicht2_lf.jpg"), _ _IrrGetTexture("../media/irrlicht2_ft.jpg"), _ _IrrGetTexture("../media/irrlicht2_bk.jpg")) ;TEXTURES $TerrainTexture0 = _IrrGetTexture("../media/splatter.tga") $TerrainTexture1 = _IrrGetTexture("../media/splatter-color.tga") $grassTexture = _IrrGetTexture("../media/grass.png") $CloudTexture = _IrrGetTexture("../media/cloud4.png") $terrainHeight = _IrrGetImage("../media/terrain-heightmap.bmp") $terrainColor = _IrrGetImage("../media/terrain-texture.jpg") $grassMap = _IrrGetImage("../media/terrain-grassmap.bmp") $heightMap = _IrrGetImage("../media/splatter-height.tga") $colorMap = _IrrGetImage("../media/splatter-detail.tga") $Font = _IrrGetFont("../media/bitmapfont.bmp") ;TERRAIN $Terrain = _IrrAddTerrainTile($heightMap, $TILE_SIZE, 0, 0) _IrrSetTileColor($Terrain, $colorMap) _IrrSetNodeScale($Terrain, 90.0, 5.4, 90.0) _IrrSetNodeMaterialTexture($Terrain, $TerrainTexture0, 0) _IrrSetNodeMaterialTexture($Terrain, $TerrainTexture1, 1) _IrrScaleTileTexture($Terrain, 64.0, 1.0) _IrrSetNodeMaterialFlag($Terrain, $IRR_EMF_FOG_ENABLE, $IRR_ON) _IrrSetNodeMaterialFlag($Terrain, $IRR_EMF_LIGHTING, $IRR_Off) _IrrSetNodeMaterialType($Terrain, $IRR_EMT_FOUR_DETAIL_MAP) _IrrSetFog(128, 128, 255, $IRR_EXPONENTIAL_FOG, 0.0, 0.0, 0) ;ZUMLIN MODEL $Zumlin = _IrrGetMesh("../media/zumlin.md2") $MeshTexture = _IrrGetTexture("../media/zumlin.pcx") $SceneNode = _IrrAddMeshToScene($Zumlin) _IrrSetNodeMaterialTexture($SceneNode, $MeshTexture, 0) _IrrSetNodeMaterialFlag($SceneNode, $IRR_EMF_LIGHTING, $IRR_Off) _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_STAND) _IrrSetNodeScale($SceneNode, 3, 3, 3) ;CAMERA $Camera = _IrrAddCamera(-150, 50, 0, 0, 0, 0) $CameraNode = $Camera ;FOR 'Third Person Shooter' LOOK $FrontNode = _IrrAddMeshToScene( _IrrGetMesh("../media/1.ms3d")) $BackNode = _IrrAddMeshToScene( _IrrGetMesh("../media/1.ms3d")) _IrrSetNodePosition($FrontNode, 5, 0, 0) _IrrSetNodePosition($BackNode, -3, 0, 0) _IrrAddChildToParent($FrontNode, $SceneNode) _IrrAddChildToParent($BackNode, $SceneNode) _IrrAddChildToParent($Camera, $SceneNode) $POS = _IrrGetNodeAbsolutePosition($SceneNode) _IrrSetCameraTarget($Camera, $POS[0], $POS[1], $POS[2]) ;LAST THINGS _IrrHideMouse() $attacktimer = TimerInit() $jumptimer = TimerInit() While _IrrRunning() ;INFO $yazi = " ..........INFO............." & @CRLF & @CRLF & _ " FPS: " & $ayazi & @CRLF & @CRLF & _ " TIMER1: " & $attacktimerr & @CRLF & @CRLF & _ " TIMER2: " & $jumptimerr & @CRLF & @CRLF & _ " MOVEMENT: " & $hareketli & @CRLF & @CRLF & _ " ATTACK: " & $atakbilgi & @CRLF & @CRLF & _ " POS: " & $poss & @CRLF & @CRLF & _ " ..........................." ;START WORKING _IrrBeginScene(128, 128, 255) ;MOVEMENT $hareketli = 0 If _IsPressed(41) Then ;A $RotationAngle -= 2;turning speed _IrrSetNodeRotation($SceneNode, 0, $RotationAngle, 0) ;$hareketli = 1 EndIf If _IsPressed(44) Then ;D $RotationAngle += 2;turning speed _IrrSetNodeRotation($SceneNode, 0, $RotationAngle, 0) ;$hareketli = 1 EndIf If _IsPressed(57) Then ;W $POS = _IrrGetNodeAbsolutePosition($FrontNode) _IrrSetNodePosition($SceneNode, $POS[0], 25, $POS[2]) $POS = _IrrGetNodeAbsolutePosition($SceneNode) _IrrSetCameraTarget($Camera, $POS[0], $POS[1], $POS[2]) _IrrSetNodeAnimationSpeed($SceneNode, 50) $hareketli = 1 EndIf If _IsPressed(53) Then ;S $POS = _IrrGetNodeAbsolutePosition($BackNode) _IrrSetNodePosition($SceneNode, $POS[0], 25, $POS[2]) $POS = _IrrGetNodeAbsolutePosition($SceneNode) _IrrSetCameraTarget($Camera, $POS[0], $POS[1], $POS[2]) _IrrSetNodeAnimationSpeed($SceneNode, 30) $hareketli = 1 EndIf ;RUNNING-STANDING ANIMATION If $hareketli = 0 And $Mert = 0 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_STAND) $Mert = 1 EndIf If $hareketli = 1 And $Mert = 1 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_RUN) $Mert = 0 EndIf ;ATTACK ANIMATION If _IsPressed(01) Then if not $mert2 <> 0 Then $Mert2 = 1 EndIf If $Mert2 = 1 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_ATTACK) $Mert2 = 2 $attacktimer = TimerInit() EndIf If $Mert2 = 2 Then $attacktimerr = TimerDiff($attacktimer) If $attacktimerr >= 300 Then If $hareketli = 1 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_RUN) Else _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_STAND) EndIf $Mert2 = 0 $attacktimer = 0 $attacktimerr = 0 EndIf EndIf ;JUMP ANIMATION If _IsPressed(20) Then if not $jump <> 0 Then $Jump = 1 EndIf If $Jump = 1 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_JUMP) $Jump = 2 $jumptimer = TimerInit() EndIf If $Jump = 2 Then $jumptimerr = TimerDiff($jumptimer) If $jumptimerr >= 450 Then If $hareketli = 1 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_RUN) If $hareketli = 0 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_STAND) $jump = 0 $jumptimer = 0 $jumptimerr = 0 EndIf EndIf ;SETTING CAMERA LOOK If _IsPressed(51) Then $poss += 0.5 _IrrSetNodePosition($Camera, $poss, 50, 0) EndIf If _IsPressed(45) Then $poss -= 0.5 _IrrSetNodePosition($Camera, $poss, 50, 0) EndIf ;COLLISION -just zumlin model- $vector3df = _IrrGetNodePosition($SceneNode) $vector3df[1] = _IrrGetTerrainTileHeight($Terrain, $vector3df[0], $vector3df[2]) _IrrSetNodePosition($SceneNode, $vector3df[0], $vector3df[1] + 80, $vector3df[2]) ;DRAW ALL OF THEM _IrrDrawScene() ;ATTACKING OR NOT -for info text- If $Mert2 = 2 Then $atakbilgi = 1 Else $atakbilgi = 0 EndIf ;If first run then set the camera look If $firstrun Then $firstrun = False $POS = _IrrGetNodeAbsolutePosition($FrontNode) _IrrSetNodePosition($SceneNode, $POS[0], 25, $POS[2]) $POS = _IrrGetNodeAbsolutePosition($SceneNode) _IrrSetCameraTarget($Camera, $POS[0], $POS[1], $POS[2]) _IrrSetNodeAnimationSpeed($SceneNode, 50) EndIf ;WRITE THE TEXT and SET THE CAPTION $ayazi = _IrrGetFPS() _Irr2DFontDraw($Font, $yazi, 4, 30, 250, 52) _IrrSetWindowCaption("FPS: " & _IrrGetFPS()) ;End Scene _IrrEndScene() WEnd _IrrStop()V1:expandcollapse popup#include "..\au3Irrlicht2.au3" #include <Misc.au3> ;Opt("MustDeclareVars", True) HotKeySet("{ESC}", "_exit") Func _exit() _IrrStop() Exit EndFunc ;==>_exit Dim $Terrain, $TerrainNode, $TerrainTexture0, $TerrainTexture1, $Camera, $CameraNode, $heightMap, $colorMap Dim $vector3df[3], $Font, $Cloud, $aCloud, $framerate, $fpsString, $SkyBox, $CameraNode, $CloudTexture Dim $CloudNode, $Zumlin, $MeshTexture, $SceneNode, $x, $y, $vect[3], $Mert, $ret, $pKeyEvent, $keyCode Dim $pMouseEvent, $POS[3], $metrics, $XStrafe, $ZStrafe, $SPIN, $TILT, $vX[3], $vY[3], $vZ[3], $MX, $MY Dim $zX = 342.8, $zY = 502.7, $zZ = 113.9, $oX, $oY, $oZ, $selector, $ellipsoidPosition[3], $ellipsoidRadius[3] Dim $velocity[3], $gravity[3], $outPosition[3], $outHitPosition[3], $outFalling, $Mert2, $hareketli, $attacktimer Dim $attacktimerr, $v, $yazi, $atakbilgi, $pMouseEvent, $POS[3], $metrics, $XStrafe, $ZStrafe, $SPIN, $TILT, $aa Dim $TILE_SIZE = 128, $ayazi, $byazi _IrrStart() _IrrTransparentZWrite() $SkyBox = _IrrAddSkyBoxToScene( _ _IrrGetTexture("../media/irrlicht2_up.jpg"), _ _IrrGetTexture("../media/irrlicht2_dn.jpg"), _ _IrrGetTexture("../media/irrlicht2_rt.jpg"), _ _IrrGetTexture("../media/irrlicht2_lf.jpg"), _ _IrrGetTexture("../media/irrlicht2_ft.jpg"), _ _IrrGetTexture("../media/irrlicht2_bk.jpg")) $TerrainTexture0 = _IrrGetTexture("../media/splatter.tga") $TerrainTexture1 = _IrrGetTexture("../media/splatter-color.tga") $terrainHeight = _IrrGetImage( "../media/terrain-heightmap.bmp" ) $terrainColor = _IrrGetImage( "../media/terrain-texture.jpg" ) $grassMap = _IrrGetImage( "../media/terrain-grassmap.bmp" ) $grassTexture = _IrrGetTexture( "../media/grass.png" ) $CloudTexture = _IrrGetTexture("../media/cloud4.png") $heightMap = _IrrGetImage("../media/splatter-height.tga") $colorMap = _IrrGetImage("../media/splatter-detail.tga") $Font = _IrrGetFont("../media/bitmapfont.bmp") $CloudNode = _IrrAddClouds($CloudTexture, 3, 1, 500) _IrrAddRotationAnimator($CloudNode, 0, 0.01, 0) $framerate = _IrrAddStaticText("Calculating ...", 4, 580, 500, 600, $IRR_GUI_BORDER, $IRR_GUI_NO_WRAP) $Terrain = _IrrAddTerrainTile($heightMap, $TILE_SIZE, 0, 0) $Zumlin = _IrrGetMesh("../media/zumlin.md2") $MeshTexture = _IrrGetTexture("../media/zumlin.pcx") $SceneNode = _IrrAddMeshToScene($Zumlin) _IrrSetNodeMaterialTexture($SceneNode, $MeshTexture, 0) _IrrSetNodeMaterialFlag($SceneNode, $IRR_EMF_LIGHTING, $IRR_OFF) _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_STAND) _IrrSetNodeScale($SceneNode, 3, 3, 3) _IrrSetNodeMaterialFlag($CloudNode, $IRR_EMF_FOG_ENABLE, $IRR_ON) _IrrSetNodePosition($CloudNode, 0, 2700, 0) _IrrSetTileColor($Terrain, $colorMap) $TerrainNode = $Terrain _IrrSetNodeScale($TerrainNode, 90.0, 5.4, 90.0) _IrrSetNodeMaterialTexture($TerrainNode, $TerrainTexture0, 0) _IrrSetNodeMaterialTexture($TerrainNode, $TerrainTexture1, 1) _IrrScaleTileTexture($Terrain, 64.0, 1.0) _IrrSetNodeMaterialFlag($TerrainNode, $IRR_EMF_FOG_ENABLE, $IRR_ON) _IrrSetNodeMaterialFlag($TerrainNode, $IRR_EMF_LIGHTING, $IRR_OFF) _IrrSetNodeMaterialType($TerrainNode, $IRR_EMT_FOUR_DETAIL_MAP) _IrrSetFog(128, 128, 255, $IRR_EXPONENTIAL_FOG, 0.0, 0.0, 0.0002) $Camera = _IrrAddFPSCamera() $CameraNode = $Camera _IrrSetNodePosition($CameraNode, 342.8, 1102.7, 113.9) _IrrSetCameraClipDistance($Camera, 12000) _IrrAddTestSceneNode() _IrrHideMouse() $attacktimer = TimerInit() $kamerabakisyonu = _IrrGetNodeRotation($Camera) _IrrSetNodeRotation($SceneNode,"",$kamerabakisyonu[1],"") While _IrrRunning() ;While _IrrIsWindowActive() $yazi = "CODE BY BILIYOMKI" & @CRLF & @CRLF & _ "FPS: " & $ayazi & @CRLF & @CRLF & _ "TIMER: " & $attacktimerr & @CRLF & @CRLF & _ "HAREKET: " & $hareketli & @CRLF & @CRLF & _ "ATAK: " & $atakbilgi & @CRLF & @CRLF & _ "MOUSE BILGI: " & $byazi _IrrBeginScene(128, 128, 255) $hareketli = 0 If _IsPressed(26) Then ;W $zX += 0.5 $hareketli = 1 EndIf If _IsPressed(28) Then ;S $zX -= 0.5 $hareketli = 1 EndIf If _IsPressed(25) Then ;A $zZ -= 0.5 ;$hareketli = 1 EndIf If _IsPressed(27) Then ;D $zZ += 0.5 ;$hareketli = 1 EndIf $kamerabakisyonu = _IrrGetNodeRotation($Camera) _IrrSetNodeRotation($SceneNode,"",$kamerabakisyonu[1] +270,"") If $hareketli = 0 And $Mert = 0 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_STAND) $Mert = 1 EndIf If $hareketli = 1 And $Mert = 1 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_RUN) $Mert = 0 EndIf If _IsPressed(01) Then $Mert2 = 1 EndIf If $Mert2 = 1 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_ATTACK) $Mert2 = 2 $attacktimer = TimerInit() EndIf If $Mert2 = 2 Then $attacktimerr = TimerDiff($attacktimer) If $attacktimerr >= 300 Then If $hareketli = 1 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_RUN) Else _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_STAND) EndIf $Mert2 = 0 $attacktimer = 0 $attacktimerr = 0 EndIf EndIf ;EndIf $vector3df = _IrrGetNodePosition($Camera) _IrrSetNodePosition($SceneNode, $vector3df[0] +250 , $vector3df[1], $vector3df[2]) ;_IrrSetNodePosition($Camera, $zX, $zY, "") $vector3df = _IrrGetNodePosition($Camera) $vector3df[1] = _IrrGetTerrainTileHeight($Terrain, $vector3df[0], $vector3df[2]) _IrrSetNodePosition($Camera, $vector3df[0], $vector3df[1] + 80, $vector3df[2]) $vector3df = _IrrGetNodePosition($SceneNode) $vector3df[1] = _IrrGetTerrainTileHeight($Terrain, $vector3df[0], $vector3df[2]) _IrrSetNodePosition($SceneNode, $vector3df[0], $vector3df[1] + 80, $vector3df[2]) _IrrDrawScene() _IrrGUISetText($framerate, "mertmertmert") If $Mert2 = 2 Then $atakbilgi = 1 Else $atakbilgi = 0 EndIf $ayazi = _IrrGetFPS() _Irr2DFontDraw($Font, $yazi, 4, 30, 250, 52) ;$Mert = _IrrGetScreenCoordinatesFrom3DPosition( $x, $y, $vect ) ;_IrrSetNodePosition( $SceneNode, 679, 500, 113.9 ) _IrrSetWindowCaption("FPS: " & _IrrGetFPS() & " | " & _IrrGetNodePosition($SceneNode)) _IrrDrawGUI() _IrrEndScene() ;WEnd WEnd _IrrStop()*moving with TPS -Updated! - Thank you so much the bogQ for movement suggestion*attack -just animation-(new)*jump -just animation-*collision*cloudsetc... i know there is a a lot of bugs but its working Edited October 28, 2010 by BiliyomKi An AutoIT user. Link to comment Share on other sites More sharing options...
linus Posted October 27, 2010 Share Posted October 27, 2010 2BiliyomKi:Quiet nice example script combining and showing several features of the UDF into one - hope you will continue with this!2jRowe:I am a little bit unhappy with top posts of this thread - first one is not very much kept up-to-date (IMHO UDF threads should show relevant info on top), second one shows completely outdated examples (suggesting this is all you can expect from our UDF ...). Would be great if you agree and find some regulary time to update them - or if you are short in time and agree: could open and maintain a new thread around au3Irr2?2all:2.05 is in work - will definetly contain more help and examples (smashly did already some really good work on this) and will also introduce basic sound support. Release somewhere around middle/end November I guess ... Link to comment Share on other sites More sharing options...
JRowe Posted October 27, 2010 Author Share Posted October 27, 2010 Just send me whatever you want changed, and I'll change them - I'm usually in every day or two. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
linus Posted October 28, 2010 Share Posted October 28, 2010 Just send me whatever you want changed, and I'll change them - I'm usually in every day or two.Hi JRowe, your thread - your baby (at least you gave birth to it!) - your decision But from point of those interested in our project, guess they would expect at least some info about latest releases, changes, highlights of releases and au3Irr2 in general. Some quickstart, short link list to further info and tools (e.g. to list of editors inside Irrlicht Wiki?). Definetly an 'outdated' tag around examples of second post ... Maybe nice place for a rough Q&A (ok, Wiki on project page would be a much better place, but not sure if it's really known/read).Maybe also some motivation for feedback/activity in different flavours - download counter on project page suggests some interest, but mostly a miracle what happens to au3Irr2 afterwards - used? Wiped from HD? Could be quiet interesting for future managing of our spare time But as this is a question of making top posts more informative especially for users/downloaders, maybe there are other/better/additional suggestions from their side!? Link to comment Share on other sites More sharing options...
smashly Posted October 28, 2010 Share Posted October 28, 2010 Hi, Just a trivial example of Diffuse, Bump Map and Parallax Mapping if anyone's interested. I used some code from Per Pixel Lighting example from IrrLicht 1.7.1 sdk. The wrapper doesn't have some functions so I had to improvise a little I made a room with Anim8tor, it was my first attempt at a small rock room using 3D software, so be forgiving...lol Zip attached with the textures and meshes I used. It's mainly just an on the fly light and texture show using animators, particles, bolts, vertex transparency and even a small gui or two.expandcollapse popup#include <GUIConstantsEx.au3> #include "au3Irrlicht2.au3" Opt("MustDeclareVars", 1) HotKeySet("{ESC}", "_Exit") Global $IRR_START = _GetDriver() ;This slows down Irr startup a little ??? Global $hBitmapFont, $hWindow, $hListbox, $hStaticText, $iSelected = 2 Global $pKeyEvent, $iKeyCode Global $hRoomMesh, $hRoomNode, $hRoomTexture, $hRoomHeightTexture Global $hEarthMesh, $iVertexCount, $tVertex, $hEarthNode, $hEarthBunpTexture Global $hBoltTexture, $aBoltNode[4][3] = [[0, -170, -170],[0, 170, 170],[0, -170, 170],[0, 170, -170]] Global $hlightNode1, $hBillboardNode1, $hBillboardTexture1, $hlightNode2, $tVectors, $hBillboardNode2, $hBillboardTexture2 Global $hParticleNode, $aEmitter, $hEmitter, $hParticleTexture Global $hCamera _IrrStart($IRR_START[0], 800, 600, $IRR_BITS_PER_PIXEL_32, _ $IRR_START[1], $IRR_SHADOWS, $IRR_CAPTURE_EVENTS, $IRR_VERTICAL_SYNC_ON) ; Add Zip file that contains the textures and meshes...etc _IrrAddZipFile("Dungeon.zip", $IRR_IGNORE_CASE, $IRR_IGNORE_PATHS) _IrrSetTextureCreationFlag($ETCF_ALWAYS_32_BIT, $IRR_ON) ; Add the Dungeon, with the options to use diffuse, bumped or parallax texturing. $hRoomMesh = _IrrGetMesh("Dungeon.3ds") $hRoomNode = _IrrAddStaticMeshForNormalMappingToScene($hRoomMesh) $hRoomTexture = _IrrGetTexture("rockwall.jpg") $hRoomHeightTexture = _IrrGetTexture("rockwall_height.bmp") _IrrMakeNormalMapTexture($hRoomHeightTexture, 9.0) _IrrSetNodeMaterialTexture($hRoomNode, $hRoomTexture, 0) _IrrSetNodeMaterialTexture($hRoomNode, $hRoomHeightTexture, 1) _IrrMaterialSetSpecularColor(_IrrGetMaterial($hRoomNode, 0), 0, 0, 0, 0) _IrrSetNodeMaterialType($hRoomNode, $IRR_EMT_PARALLAX_MAP_SOLID) _IrrMaterialSetMaterialTypeParam(_IrrGetMaterial($hRoomNode, 0), 0.035) ; Add a rotating Earth to the center of the dungeon with transparency and bump mapping $hEarthMesh = _IrrGetMesh("earth.x") _IrrScaleMesh($hEarthMesh, 35) $iVertexCount = _IrrGetMeshVertices($hEarthMesh, 0, $tVertex) For $i = 0 To $iVertexCount - 1 __SetVertStruct($tVertex, $i, $VERT_VCOLOR, _IrrMakeARGB(200, 255, 255, 255)) Next _IrrSetMeshVertices($hEarthMesh, 0, $tVertex) $hEarthNode = _IrrAddStaticMeshForNormalMappingToScene($hEarthMesh) _IrrSetNodePosition($hEarthNode, 0, 70, 0) $hEarthBunpTexture = _IrrGetTexture("earthbump.jpg") _IrrMakeNormalMapTexture($hEarthBunpTexture, 20.0) _IrrSetNodeMaterialTexture($hEarthNode, $hEarthBunpTexture, 1) _IrrSetNodeMaterialType($hEarthNode, $IRR_EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA) _IrrAddRotationAnimator($hEarthNode, 0.0, 0.1, 0.0) ; Add 4 lightning bolts to the corners of the dungeon. $hBoltTexture = _IrrGetTexture("ParticleBlue.bmp") For $i = 0 To 3 $aBoltNode[$i][0] = _IrrAddBoltSceneNode() _IrrSetBoltProperties($aBoltNode[$i][0], 0, 0, 0, 0, 170, 0, 50, 32, 4, 6, 8, $IRR_ON, 0xFF0000FF) _IrrSetNodeMaterialTexture($aBoltNode[$i][0], $hBoltTexture, 0) _IrrSetNodePosition($aBoltNode[$i][0], $aBoltNode[$i][1], 30, $aBoltNode[$i][2]) Next ; Add a 1st light with a fly circle animator and attach a red textured transparent billboard. $hlightNode1 = _IrrAddLight($IRR_NO_PARENT, 0, 0, 0, 0.5, 1.0, 0.5, 600.0) _IrrAddFlyCircleAnimator($hlightNode1, 00.0, 190.0, 0.0, 160.0, -0.003) $hBillboardNode1 = _IrrAddBillBoardToScene(60, 60, 0, 0, 0) _IrrSetNodeMaterialFlag($hBillboardNode1, $IRR_EMF_LIGHTING, $IRR_OFF) _IrrSetNodeMaterialFlag($hBillboardNode1, $IRR_EMF_ZWRITE_ENABLE, $IRR_OFF) _IrrSetNodeMaterialType($hBillboardNode1, $IRR_EMT_TRANSPARENT_ADD_COLOR) $hBillboardTexture1 = _IrrGetTexture("particlered.bmp") _IrrSetNodeMaterialTexture($hBillboardNode1, $hBillboardTexture1, 0) _IrrAddChildToParent($hBillboardNode1, $hlightNode1) ; Add a 2nd light with a spline animator, attach a white textured transparent billboard and attach a particle system. $hlightNode2 = _IrrAddLight($IRR_NO_PARENT, 0, 0, 0, 1.0, 0.2, 0.2, 600.0) $tVectors = __CreateVectStruct(14) __SetVectStruct($tVectors, 0, -156.607543945313, 62.6647033691406, -12.0654830932617) __SetVectStruct($tVectors, 1, 5.27943658828735, 92.1491241455078, 143.072448730469) __SetVectStruct($tVectors, 2, 128.767028808594, 133.425476074219, -5.31656455993652) __SetVectStruct($tVectors, 3, -5.43544769287109, 65.7600631713867, -130.104553222656) __SetVectStruct($tVectors, 4, 4.92599201202393, 182.850112915039, -2.18615889549255) __SetVectStruct($tVectors, 5, -99.9933853149414, 82.764404296875, -100.080604553223) __SetVectStruct($tVectors, 6, 99.9525375366211, 137.380004882813, -105.732864379883) __SetVectStruct($tVectors, 7, 107.130867004395, 111.526458740234, 102.391746520996) __SetVectStruct($tVectors, 8, -88.8082504272461, 73.3371734619141, 124.438987731934) __SetVectStruct($tVectors, 9, -106.799911499023, 127.780242919922, -90.9401550292969) __SetVectStruct($tVectors, 10, 34.7155494689941, 77.3034515380859, -90.3661575317383) __SetVectStruct($tVectors, 11, 84.0641479492188, 72.3169937133789, -6.07125329971313) __SetVectStruct($tVectors, 12, -1.45947682857513, 94.2630615234375, 94.4474258422852) __SetVectStruct($tVectors, 13, -1.71572148799896, 228.844131469727, 26.086841583252) _IrrAddSplineAnimator($hlightNode2, $tVectors, 0, 0.4, 1) $hBillboardNode2 = _IrrAddBillBoardToScene(110, 110, 0, 0, 0) _IrrSetNodeMaterialFlag($hBillboardNode2, $IRR_EMF_LIGHTING, $IRR_OFF) _IrrSetNodeMaterialFlag($hBillboardNode2, $IRR_EMF_ZWRITE_ENABLE, $IRR_OFF) _IrrSetNodeMaterialType($hBillboardNode2, $IRR_EMT_TRANSPARENT_ADD_COLOR) $hBillboardTexture2 = _IrrGetTexture("particlewhite.bmp") _IrrSetNodeMaterialTexture($hBillboardNode2, $hBillboardTexture2, 0) _IrrAddChildToParent($hBillboardNode2, $hlightNode2) $hParticleNode = _IrrAddParticleSystemToScene($IRR_NO_EMITTER, $hlightNode2, -1, _ 0, 0, 0, _ 0.0, 0.0, 0.0, _ 1.0, 1.0, 1.0) $aEmitter = __CreateParticleSettings(-3, 0, -3, 3, 1, 3, _ 0.0, 0.04, 0.0, _ 80, 100, _ 255, 255, 255, 255, 255, 255, _ 400, 1100, _ 25.0, 35.0, 25.0, 35.0, _ 30) $hEmitter = _IrrAddParticleEmitter($hParticleNode, $aEmitter) $hParticleTexture = _IrrGetTexture("fireball.bmp") _IrrSetNodeMaterialTexture($hParticleNode, $hParticleTexture, 0) _IrrSetNodeMaterialFlag($hParticleNode, $IRR_EMF_LIGHTING, $IRR_OFF) _IrrSetNodeMaterialFlag($hParticleNode, $IRR_EMF_ZWRITE_ENABLE, $IRR_OFF) _IrrSetNodeMaterialType($hParticleNode, $IRR_EMT_TRANSPARENT_VERTEX_ALPHA) _IrrAddFadeOutParticleAffector($hParticleNode, 500, 255, 50, 10) ; Gui for setting material type of diffuse, bumped or parallax texturing. $hBitmapFont = _IrrGetFont("fonthaettenschweiler.bmp") _IrrGUISetFont($hBitmapFont) $hWindow = _IrrAddWindow("Use 'E' + 'R' to change", 600, 475, 770, 570, $IRR_GUI_NOT_MODAL) $hListbox = _IrrAddListBox(2, 22, 165, 88, 120, $IRR_GUI_DRAW_BACKGROUND, $hWindow) _IrrAddListBoxItem($hListbox, "Diffuse") _IrrAddListBoxItem($hListbox, "Bump mapping") _IrrAddListBoxItem($hListbox, "Parallax mapping") _IrrSelectListBoxItem($hListbox, $iSelected) _SetMaterial($iSelected) ; Add a FPS camera we can move about. $hCamera = _IrrAddFPSCamera($IRR_NO_OBJECT, 100, 0.05) _IrrSetNodePosition($hCamera, 0, 70, -190) _IrrHideMouse() While _IrrRunning(); And Sleep(10) While _IrrKeyEventAvailable() $pKeyEvent = _IrrReadKeyEvent() $iKeyCode = __getKeyEvt($pKeyEvent, $EVT_KEY_IKEY) Switch $iKeyCode Case $KEY_KEY_E If BitAND(__getKeyEvt($pKeyEvent, $EVT_KEY_IDIRECTION), $IRR_KEY_DOWN) Then $iSelected -= 1 If $iSelected < 0 Then $iSelected = 2 _IrrSelectListBoxItem($hListbox, $iSelected) _SetMaterial($iSelected) EndIf Case $KEY_KEY_R If BitAND(__getKeyEvt($pKeyEvent, $EVT_KEY_IDIRECTION), $IRR_KEY_DOWN) Then $iSelected += 1 If $iSelected > 2 Then $iSelected = 0 _IrrSelectListBoxItem($hListbox, $iSelected) _SetMaterial($iSelected) EndIf EndSwitch WEnd _IrrBeginScene(0, 0, 0) _IrrDrawScene() _IrrDrawGUI() _IrrEndScene() _IrrSetWindowCaption("FPS: " & _IrrGetFPS()) WEnd ; Set the material type depending on what's selected in the listbox Func _SetMaterial($iSelected) Local $iType = $IRR_EMT_SOLID, $iSupport = 0 Switch $iSelected Case 0 $iType = $IRR_EMT_SOLID $iSupport = 1 Case 1 $iType = $IRR_EMT_NORMAL_MAP_SOLID If _IrrQueryFeature($EVDF_VERTEX_SHADER_1_1) And _IrrQueryFeature($EVDF_PIXEL_SHADER_1_1) Then $iSupport = 1 Case 2 $iType = $IRR_EMT_PARALLAX_MAP_SOLID If _IrrQueryFeature($EVDF_VERTEX_SHADER_1_1) And _IrrQueryFeature($EVDF_PIXEL_SHADER_1_4) Then $iSupport = 1 EndSwitch _IrrSetNodeMaterialType($hRoomNode, $iType) If Not $iSupport And Not $hStaticText Then $hStaticText = _IrrAddStaticText("Your hardware or this renderer is not able to use the needed shaders for this material.", 150, 20, 620, 40, $IRR_GUI_BORDER, $IRR_GUI_NO_WRAP) ElseIf $iSupport And $hStaticText Then _IrrGUIRemove($hStaticText) $hStaticText = 0 EndIf EndFunc ;==>_SetMaterial ; Just a function so the user can select the driver they want to use and fullscreen if they want. Func _GetDriver() Local $hGui, $iOK, $iFS, $iMsg, $aReturn[2] = [5, 0] Local $aRadio[6][2] = [[0, "NullDevice"],[0, "Software Renderer"],[0, "Burning's Software Renderer"],[0, "OpenGL"],[0, "Direct3D 8.1"],[0, "Direct3D 9.0c"]] $hGui = GUICreate("Driver Selection", 210, 205, -1, -1) GUICtrlCreateGroup("Select a driver for this example.", 5, 5, 200, 165) For $i = 0 To 5 $aRadio[$i][0] = GUICtrlCreateRadio($aRadio[$i][1], 15, ($i * 20) + 25, 180, 17) Next GUICtrlSetState(-1, $GUI_CHECKED) $iFS = GUICtrlCreateCheckbox("Enable Fullsecreen", 15, 145, 180, 17) $iOK = GUICtrlCreateButton("OK Lets Go!", 5, 180, 200, 20) GUISetState(@SW_SHOW, $hGui) While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $iOK For $i = 0 To 5 If BitAND(GUICtrlRead($aRadio[$i][0]), $GUI_CHECKED) Then $aReturn[0] = $i Next If BitAND(GUICtrlRead($iFS), $GUI_CHECKED) Then $aReturn[1] = 1 ExitLoop EndSwitch WEnd GUIDelete($hGui) Return $aReturn EndFunc ;==>_GetDriver Func _Exit() _IrrStop() Exit EndFunc ;==>_Exit Cheers Link to comment Share on other sites More sharing options...
kaotkbliss Posted October 28, 2010 Share Posted October 28, 2010 (edited) I've been trying to figure out if this is caused by Irrlicht and how to get around it If you run the example, you see the model move forward and back. What is supposed to be happening is everytime the model moves forward, it's supposed to be going up and when it moves backwards, it should be moving down. (and if you are familiar with milkshape you can view the animations there and see)My link*just a quick edit*the node is a miniscule dot that is used for positioning of the whole character and it's location is between the character's feet. Edited October 28, 2010 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
BiliyomKi Posted October 28, 2010 Share Posted October 28, 2010 (edited) UPDATED I dont know why i posting this but its can be -a little- example V2: expandcollapse popup;------------------------------------------ ;WSAD : Move ;Q : Camera Position + ;E ; Camera Position - ;Left Click ; Attack ;Space ; Jump ;------------------------------------------ #include "..\au3Irrlicht2.au3" #include <Misc.au3> HotKeySet("{ESC}", "_exit") Func _exit() _IrrStop() Exit EndFunc ;==>_exit ;VARIABLES Dim $Terrain, $TerrainNode, $TerrainTexture0, $TerrainTexture1, $Camera, $CameraNode, $heightMap, $colorMap Dim $vector3df[3], $Font, $Cloud, $aCloud, $framerate, $fpsString, $SkyBox, $CameraNode, $CloudTexture Dim $CloudNode, $Zumlin, $MeshTexture, $SceneNode, $x, $y, $vect[3], $Mert, $ret, $pKeyEvent, $keyCode Dim $pMouseEvent, $POS[3], $metrics, $XStrafe, $ZStrafe, $SPIN, $TILT, $vX[3], $vY[3], $vZ[3], $MX, $MY, $jumptimerr = "NOT JUMPED YET" Dim $zX = 342.8, $zY = 502.7, $zZ = 113.9, $oX, $oY, $oZ, $selector, $ellipsoidPosition[3], $ellipsoidRadius[3] Dim $velocity[3], $gravity[3], $outPosition[3], $outHitPosition[3], $outFalling, $Mert2, $hareketli, $attacktimer Dim $attacktimerr = "NOT ATTACKED YET", $v, $yazi, $atakbilgi, $pMouseEvent, $POS[3], $metrics, $XStrafe, $ZStrafe, $SPIN, $TILT, $aa Dim $TILE_SIZE = 128, $ayazi, $byazi, $RotationAngle = 0, $firstrun = True, $poss = -150, $TerrainNode = $Terrain,$jump = 0 ;LETS START _IrrStart($IRR_EDT_DIRECT3D9, @DesktopWidth - 50, @DesktopHeight - 100, $IRR_BITS_PER_PIXEL_32, $IRR_WINDOWED, $IRR_SHADOWS, $IRR_IGNORE_EVENTS, $IRR_VERTICAL_SYNC_ON) ;SKYBOX $SkyBox = _IrrAddSkyBoxToScene( _ _IrrGetTexture("../media/irrlicht2_up.jpg"), _ _IrrGetTexture("../media/irrlicht2_dn.jpg"), _ _IrrGetTexture("../media/irrlicht2_rt.jpg"), _ _IrrGetTexture("../media/irrlicht2_lf.jpg"), _ _IrrGetTexture("../media/irrlicht2_ft.jpg"), _ _IrrGetTexture("../media/irrlicht2_bk.jpg")) ;TEXTURES $TerrainTexture0 = _IrrGetTexture("../media/splatter.tga") $TerrainTexture1 = _IrrGetTexture("../media/splatter-color.tga") $grassTexture = _IrrGetTexture("../media/grass.png") $CloudTexture = _IrrGetTexture("../media/cloud4.png") $terrainHeight = _IrrGetImage("../media/terrain-heightmap.bmp") $terrainColor = _IrrGetImage("../media/terrain-texture.jpg") $grassMap = _IrrGetImage("../media/terrain-grassmap.bmp") $heightMap = _IrrGetImage("../media/splatter-height.tga") $colorMap = _IrrGetImage("../media/splatter-detail.tga") $Font = _IrrGetFont("../media/bitmapfont.bmp") ;TERRAIN $Terrain = _IrrAddTerrainTile($heightMap, $TILE_SIZE, 0, 0) _IrrSetTileColor($Terrain, $colorMap) _IrrSetNodeScale($Terrain, 90.0, 5.4, 90.0) _IrrSetNodeMaterialTexture($Terrain, $TerrainTexture0, 0) _IrrSetNodeMaterialTexture($Terrain, $TerrainTexture1, 1) _IrrScaleTileTexture($Terrain, 64.0, 1.0) _IrrSetNodeMaterialFlag($Terrain, $IRR_EMF_FOG_ENABLE, $IRR_ON) _IrrSetNodeMaterialFlag($Terrain, $IRR_EMF_LIGHTING, $IRR_Off) _IrrSetNodeMaterialType($Terrain, $IRR_EMT_FOUR_DETAIL_MAP) _IrrSetFog(128, 128, 255, $IRR_EXPONENTIAL_FOG, 0.0, 0.0, 0) ;ZUMLIN MODEL $Zumlin = _IrrGetMesh("../media/zumlin.md2") $MeshTexture = _IrrGetTexture("../media/zumlin.pcx") $SceneNode = _IrrAddMeshToScene($Zumlin) _IrrSetNodeMaterialTexture($SceneNode, $MeshTexture, 0) _IrrSetNodeMaterialFlag($SceneNode, $IRR_EMF_LIGHTING, $IRR_Off) _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_STAND) _IrrSetNodeScale($SceneNode, 3, 3, 3) ;CAMERA $Camera = _IrrAddCamera(-150, 50, 0, 0, 0, 0) $CameraNode = $Camera ;FOR 'Third Person Shooter' LOOK $FrontNode = _IrrAddMeshToScene( _IrrGetMesh("../media/1.ms3d")) $BackNode = _IrrAddMeshToScene( _IrrGetMesh("../media/1.ms3d")) _IrrSetNodePosition($FrontNode, 5, 0, 0) _IrrSetNodePosition($BackNode, -3, 0, 0) _IrrAddChildToParent($FrontNode, $SceneNode) _IrrAddChildToParent($BackNode, $SceneNode) _IrrAddChildToParent($Camera, $SceneNode) $POS = _IrrGetNodeAbsolutePosition($SceneNode) _IrrSetCameraTarget($Camera, $POS[0], $POS[1], $POS[2]) ;LAST THINGS _IrrHideMouse() $attacktimer = TimerInit() $jumptimer = TimerInit() While _IrrRunning() ;INFO $yazi = " ..........INFO............." & @CRLF & @CRLF & _ " FPS: " & $ayazi & @CRLF & @CRLF & _ " TIMER1: " & $attacktimerr & @CRLF & @CRLF & _ " TIMER2: " & $jumptimerr & @CRLF & @CRLF & _ " MOVEMENT: " & $hareketli & @CRLF & @CRLF & _ " ATTACK: " & $atakbilgi & @CRLF & @CRLF & _ " POS: " & $poss & @CRLF & @CRLF & _ " ..........................." ;START WORKING _IrrBeginScene(128, 128, 255) ;MOVEMENT $hareketli = 0 If _IsPressed(41) Then ;A $RotationAngle -= 2;turning speed _IrrSetNodeRotation($SceneNode, 0, $RotationAngle, 0) ;$hareketli = 1 EndIf If _IsPressed(44) Then ;D $RotationAngle += 2;turning speed _IrrSetNodeRotation($SceneNode, 0, $RotationAngle, 0) ;$hareketli = 1 EndIf If _IsPressed(57) Then ;W $POS = _IrrGetNodeAbsolutePosition($FrontNode) _IrrSetNodePosition($SceneNode, $POS[0], 25, $POS[2]) $POS = _IrrGetNodeAbsolutePosition($SceneNode) _IrrSetCameraTarget($Camera, $POS[0], $POS[1], $POS[2]) _IrrSetNodeAnimationSpeed($SceneNode, 50) $hareketli = 1 EndIf If _IsPressed(53) Then ;S $POS = _IrrGetNodeAbsolutePosition($BackNode) _IrrSetNodePosition($SceneNode, $POS[0], 25, $POS[2]) $POS = _IrrGetNodeAbsolutePosition($SceneNode) _IrrSetCameraTarget($Camera, $POS[0], $POS[1], $POS[2]) _IrrSetNodeAnimationSpeed($SceneNode, 30) $hareketli = 1 EndIf ;RUNNING-STANDING ANIMATION If $hareketli = 0 And $Mert = 0 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_STAND) $Mert = 1 EndIf If $hareketli = 1 And $Mert = 1 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_RUN) $Mert = 0 EndIf ;ATTACK ANIMATION If _IsPressed(01) Then if not $mert2 <> 0 Then $Mert2 = 1 EndIf If $Mert2 = 1 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_ATTACK) $Mert2 = 2 $attacktimer = TimerInit() EndIf If $Mert2 = 2 Then $attacktimerr = TimerDiff($attacktimer) If $attacktimerr >= 300 Then If $hareketli = 1 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_RUN) Else _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_STAND) EndIf $Mert2 = 0 $attacktimer = 0 $attacktimerr = 0 EndIf EndIf ;JUMP ANIMATION If _IsPressed(20) Then if not $jump <> 0 Then $Jump = 1 EndIf If $Jump = 1 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_JUMP) $Jump = 2 $jumptimer = TimerInit() EndIf If $Jump = 2 Then $jumptimerr = TimerDiff($jumptimer) If $jumptimerr >= 450 Then If $hareketli = 1 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_RUN) If $hareketli = 0 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_STAND) $jump = 0 $jumptimer = 0 $jumptimerr = 0 EndIf EndIf ;SETTING CAMERA LOOK If _IsPressed(51) Then $poss += 0.5 _IrrSetNodePosition($Camera, $poss, 50, 0) EndIf If _IsPressed(45) Then $poss -= 0.5 _IrrSetNodePosition($Camera, $poss, 50, 0) EndIf ;COLLISION -just zumlin model- $vector3df = _IrrGetNodePosition($SceneNode) $vector3df[1] = _IrrGetTerrainTileHeight($Terrain, $vector3df[0], $vector3df[2]) _IrrSetNodePosition($SceneNode, $vector3df[0], $vector3df[1] + 80, $vector3df[2]) ;DRAW ALL OF THEM _IrrDrawScene() ;ATTACKING OR NOT -for info text- If $Mert2 = 2 Then $atakbilgi = 1 Else $atakbilgi = 0 EndIf ;If first run then set the camera look If $firstrun Then $firstrun = False $POS = _IrrGetNodeAbsolutePosition($FrontNode) _IrrSetNodePosition($SceneNode, $POS[0], 25, $POS[2]) $POS = _IrrGetNodeAbsolutePosition($SceneNode) _IrrSetCameraTarget($Camera, $POS[0], $POS[1], $POS[2]) _IrrSetNodeAnimationSpeed($SceneNode, 50) EndIf ;WRITE THE TEXT and SET THE CAPTION $ayazi = _IrrGetFPS() _Irr2DFontDraw($Font, $yazi, 4, 30, 250, 52) _IrrSetWindowCaption("FPS: " & _IrrGetFPS()) ;End Scene _IrrEndScene() WEnd _IrrStop() V1: expandcollapse popup#include "..\au3Irrlicht2.au3" #include <Misc.au3> ;Opt("MustDeclareVars", True) HotKeySet("{ESC}", "_exit") Func _exit() _IrrStop() Exit EndFunc ;==>_exit Dim $Terrain, $TerrainNode, $TerrainTexture0, $TerrainTexture1, $Camera, $CameraNode, $heightMap, $colorMap Dim $vector3df[3], $Font, $Cloud, $aCloud, $framerate, $fpsString, $SkyBox, $CameraNode, $CloudTexture Dim $CloudNode, $Zumlin, $MeshTexture, $SceneNode, $x, $y, $vect[3], $Mert, $ret, $pKeyEvent, $keyCode Dim $pMouseEvent, $POS[3], $metrics, $XStrafe, $ZStrafe, $SPIN, $TILT, $vX[3], $vY[3], $vZ[3], $MX, $MY Dim $zX = 342.8, $zY = 502.7, $zZ = 113.9, $oX, $oY, $oZ, $selector, $ellipsoidPosition[3], $ellipsoidRadius[3] Dim $velocity[3], $gravity[3], $outPosition[3], $outHitPosition[3], $outFalling, $Mert2, $hareketli, $attacktimer Dim $attacktimerr, $v, $yazi, $atakbilgi, $pMouseEvent, $POS[3], $metrics, $XStrafe, $ZStrafe, $SPIN, $TILT, $aa Dim $TILE_SIZE = 128, $ayazi, $byazi _IrrStart() _IrrTransparentZWrite() $SkyBox = _IrrAddSkyBoxToScene( _ _IrrGetTexture("../media/irrlicht2_up.jpg"), _ _IrrGetTexture("../media/irrlicht2_dn.jpg"), _ _IrrGetTexture("../media/irrlicht2_rt.jpg"), _ _IrrGetTexture("../media/irrlicht2_lf.jpg"), _ _IrrGetTexture("../media/irrlicht2_ft.jpg"), _ _IrrGetTexture("../media/irrlicht2_bk.jpg")) $TerrainTexture0 = _IrrGetTexture("../media/splatter.tga") $TerrainTexture1 = _IrrGetTexture("../media/splatter-color.tga") $terrainHeight = _IrrGetImage( "../media/terrain-heightmap.bmp" ) $terrainColor = _IrrGetImage( "../media/terrain-texture.jpg" ) $grassMap = _IrrGetImage( "../media/terrain-grassmap.bmp" ) $grassTexture = _IrrGetTexture( "../media/grass.png" ) $CloudTexture = _IrrGetTexture("../media/cloud4.png") $heightMap = _IrrGetImage("../media/splatter-height.tga") $colorMap = _IrrGetImage("../media/splatter-detail.tga") $Font = _IrrGetFont("../media/bitmapfont.bmp") $CloudNode = _IrrAddClouds($CloudTexture, 3, 1, 500) _IrrAddRotationAnimator($CloudNode, 0, 0.01, 0) $framerate = _IrrAddStaticText("Calculating ...", 4, 580, 500, 600, $IRR_GUI_BORDER, $IRR_GUI_NO_WRAP) $Terrain = _IrrAddTerrainTile($heightMap, $TILE_SIZE, 0, 0) $Zumlin = _IrrGetMesh("../media/zumlin.md2") $MeshTexture = _IrrGetTexture("../media/zumlin.pcx") $SceneNode = _IrrAddMeshToScene($Zumlin) _IrrSetNodeMaterialTexture($SceneNode, $MeshTexture, 0) _IrrSetNodeMaterialFlag($SceneNode, $IRR_EMF_LIGHTING, $IRR_OFF) _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_STAND) _IrrSetNodeScale($SceneNode, 3, 3, 3) _IrrSetNodeMaterialFlag($CloudNode, $IRR_EMF_FOG_ENABLE, $IRR_ON) _IrrSetNodePosition($CloudNode, 0, 2700, 0) _IrrSetTileColor($Terrain, $colorMap) $TerrainNode = $Terrain _IrrSetNodeScale($TerrainNode, 90.0, 5.4, 90.0) _IrrSetNodeMaterialTexture($TerrainNode, $TerrainTexture0, 0) _IrrSetNodeMaterialTexture($TerrainNode, $TerrainTexture1, 1) _IrrScaleTileTexture($Terrain, 64.0, 1.0) _IrrSetNodeMaterialFlag($TerrainNode, $IRR_EMF_FOG_ENABLE, $IRR_ON) _IrrSetNodeMaterialFlag($TerrainNode, $IRR_EMF_LIGHTING, $IRR_OFF) _IrrSetNodeMaterialType($TerrainNode, $IRR_EMT_FOUR_DETAIL_MAP) _IrrSetFog(128, 128, 255, $IRR_EXPONENTIAL_FOG, 0.0, 0.0, 0.0002) $Camera = _IrrAddFPSCamera() $CameraNode = $Camera _IrrSetNodePosition($CameraNode, 342.8, 1102.7, 113.9) _IrrSetCameraClipDistance($Camera, 12000) _IrrAddTestSceneNode() _IrrHideMouse() $attacktimer = TimerInit() $kamerabakisyonu = _IrrGetNodeRotation($Camera) _IrrSetNodeRotation($SceneNode,"",$kamerabakisyonu[1],"") While _IrrRunning() ;While _IrrIsWindowActive() $yazi = "CODE BY BILIYOMKI" & @CRLF & @CRLF & _ "FPS: " & $ayazi & @CRLF & @CRLF & _ "TIMER: " & $attacktimerr & @CRLF & @CRLF & _ "HAREKET: " & $hareketli & @CRLF & @CRLF & _ "ATAK: " & $atakbilgi & @CRLF & @CRLF & _ "MOUSE BILGI: " & $byazi _IrrBeginScene(128, 128, 255) $hareketli = 0 If _IsPressed(26) Then ;W $zX += 0.5 $hareketli = 1 EndIf If _IsPressed(28) Then ;S $zX -= 0.5 $hareketli = 1 EndIf If _IsPressed(25) Then ;A $zZ -= 0.5 ;$hareketli = 1 EndIf If _IsPressed(27) Then ;D $zZ += 0.5 ;$hareketli = 1 EndIf $kamerabakisyonu = _IrrGetNodeRotation($Camera) _IrrSetNodeRotation($SceneNode,"",$kamerabakisyonu[1] +270,"") If $hareketli = 0 And $Mert = 0 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_STAND) $Mert = 1 EndIf If $hareketli = 1 And $Mert = 1 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_RUN) $Mert = 0 EndIf If _IsPressed(01) Then $Mert2 = 1 EndIf If $Mert2 = 1 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_ATTACK) $Mert2 = 2 $attacktimer = TimerInit() EndIf If $Mert2 = 2 Then $attacktimerr = TimerDiff($attacktimer) If $attacktimerr >= 300 Then If $hareketli = 1 Then _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_RUN) Else _IrrPlayNodeMD2Animation($SceneNode, $IRR_EMAT_STAND) EndIf $Mert2 = 0 $attacktimer = 0 $attacktimerr = 0 EndIf EndIf ;EndIf $vector3df = _IrrGetNodePosition($Camera) _IrrSetNodePosition($SceneNode, $vector3df[0] +250 , $vector3df[1], $vector3df[2]) ;_IrrSetNodePosition($Camera, $zX, $zY, "") $vector3df = _IrrGetNodePosition($Camera) $vector3df[1] = _IrrGetTerrainTileHeight($Terrain, $vector3df[0], $vector3df[2]) _IrrSetNodePosition($Camera, $vector3df[0], $vector3df[1] + 80, $vector3df[2]) $vector3df = _IrrGetNodePosition($SceneNode) $vector3df[1] = _IrrGetTerrainTileHeight($Terrain, $vector3df[0], $vector3df[2]) _IrrSetNodePosition($SceneNode, $vector3df[0], $vector3df[1] + 80, $vector3df[2]) _IrrDrawScene() _IrrGUISetText($framerate, "mertmertmert") If $Mert2 = 2 Then $atakbilgi = 1 Else $atakbilgi = 0 EndIf $ayazi = _IrrGetFPS() _Irr2DFontDraw($Font, $yazi, 4, 30, 250, 52) ;$Mert = _IrrGetScreenCoordinatesFrom3DPosition( $x, $y, $vect ) ;_IrrSetNodePosition( $SceneNode, 679, 500, 113.9 ) _IrrSetWindowCaption("FPS: " & _IrrGetFPS() & " | " & _IrrGetNodePosition($SceneNode)) _IrrDrawGUI() _IrrEndScene() ;WEnd WEnd _IrrStop() *moving with TPS -Updated! - Thank you so much the bogQ for movement suggestion *attack -just animation- (new)*jump -just animation- *collision *clouds etc... i know there is a a lot of bugs but its working Edited October 28, 2010 by BiliyomKi An AutoIT user. Link to comment Share on other sites More sharing options...
Nothing2Lose Posted October 30, 2010 Share Posted October 30, 2010 How can i create font to use in Irrlicht??? Link to comment Share on other sites More sharing options...
kaotkbliss Posted October 30, 2010 Share Posted October 30, 2010 I'm not sure how the bmp was created for the example, but I would think that all you would need is a photoshop program. Most have the insert text option. I believe all you would need to do is type out each letter of the font you want (Upper and lower case) and then save the image as a bmp. It's just a guess and I have not messed with making my own fonts yet. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
linus Posted October 30, 2010 Share Posted October 30, 2010 I've been trying to figure out if this is caused by Irrlicht and how to get around it If you run the example, you see the model move forward and back. What is supposed to be happening is everytime the model moves forward, it's supposed to be going up and when it moves backwards, it should be moving down. (and if you are familiar with milkshape you can view the animations there and see) Hi kaotkbliss, referring to replies you got until now I assume we are nothing more than a 'community' of 3D noobs bound to own coding things OK, although not to much knowledge of those animation things I took finally some time trying to give you a second view: Short conclusion: export the body from milkshape as .b3d and it works as expected. Long conclusion: the movement of the body is defined in milkshape along Y but exported for Z (no difference between animation in your script and when opening the .ms3d in irrEdit). And: when I open your model in milkshape and save without changes again as .ms3d I get a lot of wrong faces when running your script. So I would guess there is something wrong with the model data itself. Next I did a quick&dirty model in milkshape from scratch with up and down movement, and it works as defined, example shows both in comparison (copy into your example dir): kaotblissExample.zip My knowledge of this is really basic so maybe completely wrong, but would say this model is not originaly done as .ms3d, right? Instead it is imported from another 3D format, then saved to .ms3d. Import of milkshape did something wrong and this is also saved wrong to final .ms3d. Also export to .x is wrong. Only exporter to .b3d seems to work correctly for this special case. As said, I am also a noob to this, so my analysis may be nothing but stupid. Hope you can use this and find out more, animation with milkshape seems to be powerful but also little bit tricky UPDATEDHi BiliyomKi, unfortunately V2 is not working for me (your script uses '1.ms3d' I do not have). Maybe you can provide a complete package with e.g. \media2 for those files not included in standard \media? How can i create font to use in Irrlicht???Short question - short answer: FontTool.exe from Irrlicht SDK. Link to comment Share on other sites More sharing options...
kaotkbliss Posted October 30, 2010 Share Posted October 30, 2010 Hi Linus. Thanks for your time. I had some funny issues before using 3ds models where in 3dsmax they were positioned fine, but when opened in other programs and used in irrlicht they were tilted off axis so I figured that may be something of the case here. Only thing that was confusing me is the model was positioned correctly so I would have thought that if the axis was changed, the positioning of the model would have changed. And yes, you are correct, the models from VTM: Bloodlines were created in 3dsMax, saved as smd files and packed with special software to vpk files. So I imported the smd files into milkshape and saved them as ms3d. Since Everything looked correct when used in Irrlicht I decided this would be the easiest option. Short answer: I had no clue where the problem was. Hopefully by the time I'm done with this project I will no longer be a n00b lol. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Nothing2Lose Posted October 31, 2010 Share Posted October 31, 2010 Yes, I see. But how can i know the order of character? haettenschweiler font was used in examples. When i used bitmapfont.bmp, it only displayed some character... Link to comment Share on other sites More sharing options...
linus Posted October 31, 2010 Share Posted October 31, 2010 But how can i know the order of character? haettenschweiler font was used in examples. When i used bitmapfont.bmp, it only displayed some character... You'll see it when open and compare bitmaps of haettenschweiler and bitmapfont: bitmapfont includes only subset of characters (capitals + numbers). Didn't created own fontmaps yet, but would guess the order simply follows ASCII/ANSI. Link to comment Share on other sites More sharing options...
linus Posted October 31, 2010 Share Posted October 31, 2010 Thanks for your time.... no problem, your questions around anim aren't easy to follow but interesting (finally thinkin' into gave me much more understanding of using animations = next small step away from noob status ) Also (again) the fact that 3D importer/exporter of editors/engines may or may not do what expected; although both say "sure I support it" Maybe there is a hidden thing in milkshape to fix interchanged axes of your model, but couldn't find anything ... Anyway, you are on the lucky side as .b3D export will do what you need.BTW: just a thought, but think material you are using has copyright - wouldn't it be better to use own or free ressources so you can provide your finished project without any "guilty conscience"? Link to comment Share on other sites More sharing options...
Nothing2Lose Posted October 31, 2010 Share Posted October 31, 2010 Thank you very much! Link to comment Share on other sites More sharing options...
E1M1 Posted October 31, 2010 Share Posted October 31, 2010 (edited) why somemost of those scripts crash for me? When i run it, it draws GUI and then I see message "Autoit 2 script has stopped working" I have autoit 3.3.6.1 on win 7 x64 Edited October 31, 2010 by E1M1 edited Link to comment Share on other sites More sharing options...
linus Posted October 31, 2010 Share Posted October 31, 2010 (edited) why somemost of those scripts crash for me? When i run it, it draws GUI and then I see message "Autoit 2 script has stopped working" I have autoit 3.3.6.1 on win 7 x64Guess you are running scripts with 64bit version of au3 - au3Irr2 uses 32bit dll's, so try running also au3 as 32bitEdit: Have no 64bit system, so can you do me a favour and add #AutoIt3Wrapper_UseX64=Nto your local au3Irrlicht.au3, then try again. If this fix your problem, I'll add this for next release. Edited October 31, 2010 by linus Link to comment Share on other sites More sharing options...
E1M1 Posted October 31, 2010 Share Posted October 31, 2010 Updating my drivers fixed most of my problems but still some examples doesnt work..... I dont think 32bit dlls are problem, I pöay some 32bit games and they work nicely. edited Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now