Jump to content

Au3Irrlicht Sqrt problem


bogQ
 Share

Recommended Posts

I know its dumb exsample and someone will ask why i dont tupe 10000 to set time.

#include <..\IrrlichtPluginUtils.au3>
AutoItSetOption( "TrayIconHide", 1 )
$ModelsDir = @ScriptDir & "\Models\"
CreateDevice( $EDT_OPENGL, 640, 480, 16 )
$Static = AddStaticText( "", 10, 10, 130, 20, 1 )
$Light = AddLightSceneNode( 0, 2000, 2000, 0, 1, 1, 1, 10000 )
AddCameraSceneNode( 0, 250, 30, -100, 0, 50, 0 )
$FloorMesh = AddHillPlaneMesh( "Floor", 15, 15, 100, 100, 0, 0.0, 0, 0, 2, 2 )
$FloorNode = AddOctTreeSceneNode( $FloorMesh )
SetMaterialTexture( $FloorNode, 0, GetTexture( @ScriptDir & "\data\terrain-texture.bmp" ) )
$VaderMesh = GetMesh( $ModelsDir & "DarthVader\tris.md2" )
$VaderNode = AddAnimatedMeshSceneNode( $VaderMesh )
SetMD2Animation( $VaderNode, $EMAT_RUN )
SetAnimationSpeed( $VaderNode, 30 )
SetLoopMode( $VaderNode, 1 )

$blafin = Sqrt ( 10000 ) * Sqrt ( 10000 )
MsgBox(0,"",$blafin )
$CharRunAnimator = CreateFlyStraightAnimator( -400, 24, 20, 400, 24, 20, $blafin, 1 )

AddAnimator( $VaderNode, $CharRunAnimator )
$SwitchMesh = GetMesh( $ModelsDir & "switch\switch.md2" )
$SwitchTexture = GetTexture( $ModelsDir & "switch\switch.png" )
$Switch1Node = AddAnimatedMeshSceneNode( $SwitchMesh )
SetMaterialTexture( $Switch1Node, 0, $SwitchTexture )
SetLoopMode( $Switch1Node, 0 )
SetPosition( $Switch1Node, -200, 2, -40 )
$Switch2Node = AddAnimatedMeshSceneNode( $SwitchMesh )
SetMaterialTexture( $Switch2Node, 0, $SwitchTexture )
SetLoopMode( $Switch2Node, 0 )
SetPosition( $Switch2Node, 100, 2, -40 )
$InitTime = 0
While IrrRun( )
    BeginScene( true, true, 255, 100, 100, 100 )
    SceneDraw( )
    $CollNode = GetSceneNodeFromRayBB( -200, 5, 30, -200, 5, -30 )
    If $CollNode = $VaderNode Then
        SetText( $Static, "Vader passed checkpoint 1." )
        SetMD2Animation( $Switch1Node, $EMAT_STAND )
        $InitTime = TimerInit( )
    Else
        If TimerDiff( $InitTime ) > 1000 Then SetText( $Static, "" )
    EndIf
    $CollNode = GetSceneNodeFromRayBB( 100, 5, 30, 100, 5, -30 )
    If $CollNode = $VaderNode Then
        SetText( $Static, "Vader passed checkpoint 2." )
        SetMD2Animation( $Switch2Node, $EMAT_STAND )
        $InitTime = TimerInit( )
    Else
        If TimerDiff( $InitTime ) > 1000 Then SetText( $Static, "" )
    EndIf
    GuiDraw( )
    EndScene( )
    Sleep( 10 )
Wend

Becose i need Sqrt to have correct speed on prefered distance from two objects

$blax = $mobx - $NodePX_001

$blaz = $mobz- $NodePZ_001

$blafin = Sqrt( ( $blax * $blax ) + ( $blaz * $blaz ) )

i tryed with $CharRunAnimator = CreateFlyStraightAnimator( -400, 24, 20, 400, 24, 20, Number($blafin), 1 ) and its not working any sugestions on what m i missing heare ?

edit:

i have dumb solution that helps in thes specific variable problem (becose irr only aknoleg numbers and at the moment i dont see any other option)

$blafin = Sqrt ( 10000 ) * Sqrt ( 10000 )

For $r = 1 to $blafin

Next

MsgBox(0,"",$blafin )

$CharRunAnimator = CreateFlyStraightAnimator( -400, 24, 20, 400, 24, 20, $r, 1 )

i dont think its best solution but its onlyone that i have now :/ any other sugestion pls? Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

You should use Ceiling, Floor or Round to get an Integer;)

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

You should use Ceiling, Floor or Round to get an Integer;)

i did try it and still no reaction from StraightAnimator :/ , if i type 10000 directly or Number("10000") on that command its working, and as soon as i try to use Sqrt in any part of it its not working :/ its like that var is not longer recognized as number and i cant change it to numeric no mather what i try. I supose im dooing something wrong to the format of var. Sqrt(10000) = 100 100*100 = 10000 and its not working >_<

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

sry for duble post

i finded crazy better woirking solution for now

$blafin = Ceiling(Sqrt ( 10000 ) * Sqrt ( 10000 ))

Number(String($blafin)) :( >_<

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...