Results 1 to 10 of 10

Thread: tbgl_entitygetaxis help needed

  1. #1
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    tbgl_entitygetaxis help needed

    Hi Petr, I spent about 2 hours trying to figure out how to get the rotation value of an entity, but not getting ahead to well.

    First, there are 3 commands, where as in tbgl_entitygetpos there is only one. It seems like a command, tbgl_entitygetrot (scene, entity, x, y, z) would exist.

    I used tbgl_entitygetaxisX
    tbgl_entitygetaxisy
    tbgl_entitygetaxisz

    but I get a 1 or 0 and it doesn't update with current rotation numbers.

    Thanks for any help and clarification, sorry to bother you when you are busy for school, but if I wasn't so stuck, wouldn' have asked.
    Thanks.

    Oh-- also, I can't seem to find dr aerix game of forums? I was going to look in there to see if we used any rotation get commands, I can't remember
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: tbgl_entitygetaxis help needed

    Hi Kent,

    in Dr.Aeraix we used TBGL_EntitySyncAxes - which simply served to synchronize axes of two existing entities (rocket inherited rotation from camera).
    The demo is still here.

    Are you sure about TBGL_EntityGet{X|Y|Z}Axis not working? Did you had passed x, y, z defined as floating point?

    See this example, seems to work:
    [code=thinbasic]
    Uses "TBGL"

    ' -- Create and show window
    Dim hWnd As Dword = TBGL_CreateWindowEx("Mad rotations", 640, 480, 32, %TBGL_WS_WINDOWED or %TBGL_WS_CLOSEBOX)
    TBGL_ShowWindow

    ' -- Create scene
    %SCENE1 = 1
    TBGL_SceneCreate(%SCENE1)

    ' -- Create basic entities

    %eBox = 20

    ' -- Create something to look at
    TBGL_EntityCreateBox(%SCENE1, %eBox, 0, 1, 1, 1, 0, 255, 128, 0)
    TBGL_EntitySetPos(%SCENE1, %eBox, 0, 0, 0)
    dim x, y, z as double
    dim AxesString as string= "Original axes:"+$CRLF+$CRLF
    TBGL_EntityGetXAxis(%SCENE1, %eBox, x, y, z)
    AxesString+= "X:"+$TAB+using$("#.## #.## #.##", x, y, z)+$CRLF
    TBGL_EntityGetYAxis(%SCENE1, %eBox, x, y, z)
    AxesString+= "Y:"+$TAB+using$("#.## #.## #.##", x, y, z)+$CRLF
    TBGL_EntityGetZAxis(%SCENE1, %eBox, x, y, z)
    AxesString+= "Z:"+$TAB+using$("#.## #.## #.##", x, y, z)+$CRLF

    tbgl_entitySetRot(%SCENE1, %eBox, 10, 20, 30)
    AxesString+= REPEAT$(60, "-")+$CRLF+"After tbgl_entitySetRot(%SCENE1, %eBox, 10, 20, 30):"+$CRLF+$CRLF
    TBGL_EntityGetXAxis(%SCENE1, %eBox, x, y, z)
    AxesString+= "X:"+$TAB+using$("#.## #.## #.##", x, y, z)+$CRLF
    TBGL_EntityGetYAxis(%SCENE1, %eBox, x, y, z)
    AxesString+= "Y:"+$TAB+using$("#.## #.## #.##", x, y, z)+$CRLF
    TBGL_EntityGetZAxis(%SCENE1, %eBox, x, y, z)
    AxesString+= "Z:"+$TAB+using$("#.## #.## #.##", x, y, z)+$CRLF

    msgbox hwnd, AxesString

    TBGL_DestroyWindow
    [/code]

    Hope it will work for you too


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: tbgl_entitygetaxis help needed

    Thanks Petr, your script works, getting too sleepy to figure mine out. Will look with fresh eyes tomorrow, well later today

    Tonight is when I release my new project, so by Friday sometime it should appear for everyone.
    If I waited till I finished except for sound, it would still be a couple of weeks. As I progress in it, more and more ideas come, so it is exciting.

    Sorry for the suspense, but need to make some excitement for it, he he he he.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  4. #4
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: tbgl_entitygetaxis help needed

    Hi Kent,

    I am really curious!
    When in trouble, just send me even part of code ( to not spoil surprise ) and I will try to help you.


    Petr



    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  5. #5
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: tbgl_entitygetaxis help needed

    Petr, believe me there were many times when I wanted to send you scripts for help, but 2 things...
    First I know you are busy with school work.
    Second, I want this to be a total surprise to you and everyone... anyways back to work if I am to release tonight
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  6. #6
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: tbgl_entitygetaxis help needed

    Petr, it is not working for me... here is how I am trying to use it:
    Why is there 3 different commands, when it seems it returns, xyz and in all cases when it works?

    [code=thinbasic]Uses "TBGL"

    ' -- Create and show window
    Dim hWnd As Dword = TBGL_CreateWindowEx("Mad rotations", 640, 480, 32, %TBGL_WS_WINDOWED or %TBGL_WS_CLOSEBOX)
    TBGL_ShowWindow

    ' -- Create scene
    %SCENE1 = 1
    TBGL_SceneCreate(%SCENE1)

    ' -- Create basic entities

    %eBox = 20

    ' -- Create something to look at
    TBGL_EntityCreateBox(%SCENE1, %eBox, 0, 1, 1, 1, 0, 255, 128, 0)
    TBGL_EntitySetPos(%SCENE1, %eBox, 0, 0, 0)
    dim x, y, z as double
    dim AxesString as string= "Original axes:"+$CRLF+$CRLF
    TBGL_EntityGetXAxis(%SCENE1, %eBox, x, y, z)
    AxesString+= "X:"+$TAB+using$("#.## #.## #.##", x, y, z)+$CRLF
    TBGL_EntityGetYAxis(%SCENE1, %eBox, x, y, z)
    AxesString+= "Y:"+$TAB+using$("#.## #.## #.##", x, y, z)+$CRLF
    TBGL_EntityGetZAxis(%SCENE1, %eBox, x, y, z)
    AxesString+= "Z:"+$TAB+using$("#.## #.## #.##", x, y, z)+$CRLF

    'tbgl_entitySetRot(%SCENE1, %eBox, 10, 20, 30)
    tbgl_entityturn (%SCENE1, %eBox, 0, 10, 0)
    'AxesString+= REPEAT$(60, "-")+$CRLF+"After tbgl_entitySetRot(%SCENE1, %eBox, 10, 20, 30):"+$CRLF+$CRLF
    AxesString+= REPEAT$(60, "-")+$CRLF+"After tbgl_entityturn(%SCENE1, %eBox, 0, 10,0):"+$CRLF+$CRLF
    TBGL_EntityGetXAxis(%SCENE1, %eBox, x, y, z)
    AxesString+= "X:"+$TAB+using$("#.## #.## #.##", x, y, z)+$CRLF
    TBGL_EntityGetYAxis(%SCENE1, %eBox, x, y, z)
    AxesString+= "Y:"+$TAB+using$("#.## #.## #.##", x, y, z)+$CRLF
    TBGL_EntityGetZAxis(%SCENE1, %eBox, x, y, z)
    AxesString+= "Z:"+$TAB+using$("#.## #.## #.##", x, y, z)+$CRLF

    msgbox hwnd, AxesString

    TBGL_DestroyWindow[/code]
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  7. #7
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: tbgl_entitygetaxis help needed

    Hi Kent,

    maybe you think that TBGL_EntityGetXAxis returns something else?
    I prepaired a short rendered tutorial for you, just click on attachement and hit open ( works only on PCs with thinBASIC installed ).


    Petr
    Attached Files Attached Files
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  8. #8
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: tbgl_entitygetaxis help needed

    That is just very very cool answer and only can come from such a talented and nice guy, thanks!

    You know me always looking for easy way... how about a command that tells in degrees.

    tbgl_entitygetrot(sceneid, entityid, rotx, roty, rotz, flag degrees or radians) default degrees
    and actually it will be nice to just send type xyz to get the values assigned too.

    so it would be like the opposite of entityturn, that you give the degrees, in the new command you get the degrees?

    Will think about things while sleep, almost 5:30am again...
    Thanks for help!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  9. #9
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: tbgl_entitygetaxis help needed

    Hi Kent,

    we discussed this with Mike some time ago - the matrix / axes is something clear, without possibility of "wrong" interpretation.
    Express rotation in angles after few transformations is a bit of hell - it depends on order the angles were applied. So I need to think about it more.


    Thanks,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  10. #10
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: tbgl_entitygetaxis help needed

    Petr, when I saw your latest version, you put in the feature I couldn't figure out, which is the rotating tank icon in the radar.
    I will examine that code this weekend and that will give me the answers I need.

    I understand now what you are talking about rotation horror in angles, you are right, we want rock solid effect and control, this is the way to go. I just need help in understanding it. I will get this I promise!!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

Similar Threads

  1. Mission 1: Which media is needed?
    By Michael Hartlef in forum Media material
    Replies: 8
    Last Post: 24-03-2007, 07:52
  2. Distributing ThinBasic with IndeED, what is needed?
    By Michael Hartlef in forum thinBasic General
    Replies: 4
    Last Post: 18-12-2006, 14:56

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •