Menu

Changin from a static behavior to a dynamic behavior in runtime

Physics
Sergio
2022-02-11
2022-03-09
  • Sergio

    Sergio - 2022-02-11

    How to make two dynamic behaviors to start in different times ( TGLODEDynamic.)
    I have a closed box made of TGLcube walls. In the initial moment of the GLcadencer1Progress I start to create many small spheres inside the box. I need that all the 6 walls remain” static”. The spheres will reflect in the walls and move inside colliding between them and the walls. I know how to do this with a static behavior.
    My doubt is the following:
    I need that after a certain time (and not from the beginning of the spheres creation) , when the box will be plenty of spheres, one of the walls (with a hinge and dynamic behavior) will start to open due t to the collisions of the spheres.
    So, my doubt is how to change from a static behavior to a dynamic behavior in runtime
    Can any one help me ? The basis for this is in this my old post https://sourceforge.net/p/glscene/discussion/93605/thread/24fb378b44/?limit=25#72eb . However there there is just a static behavior

     
  • Pavel Vassiliev

    Pavel Vassiliev - 2022-02-12

    Dear Sergio,
    I've updated additional ODE examples in https://sourceforge.net/p/glscene/code/HEAD/tree/branches/Examples/Physics/ODE/. May be you will find some hint how to solve your task there.
    Pavel

     
  • Sergio

    Sergio - 2022-02-13

    thank you very much Tomorrow i Will check each one and comment

     
  • Sergio

    Sergio - 2022-02-13

    Hi Pavel You did once more a great work
    I went to one by one of the demos (some few new for me) and checked. Soon I will send you some extra demos to post if you find useful. I could remeber yesterday the way of doing what I need but with these demos ideas became more clear
    Here are some smalls issues that may be useful for this set of demos . I am using the last version (I think)

    BOX STACK 1 and 2
    Change TGLcolor vector by Tcolorvector
    CHAIN1 and SLIDER
    add the icon to the directory
    SPINNING TOP
    Compile but an error come after
    FPLANE2D
    -- message no contacts requested in dcollide
    TRIMESH
    Access violation
    AREA ODE
    Seems good but the objective is not clear (ggod to set acceleration and mass)
    ODE simple
    Unit madeExcept not found
    SPININGTOP and ODETERRABOX
    Some error
    GRAVITY, SIMPLE CAR
    Great and working
    RAGDOLL
    The scene appear with the steps but I could not make the doll to appear

     
    • Pavel Vassiliev

      Pavel Vassiliev - 2022-02-14

      Well Sergio,
      ...Change TGLcolorvector by Tcolorvector...
      No, It should be TGLColorVector = TVector4f; from current GLS.Color unit
      not to have conflicts with declarations from other libs, mainly in c++builder.

      CHAIN1 and SLIDER
      ... add the icon to the directory...
      Usually you don't need to add an icon to the directory, but simply add the default icon for the project in options. And so on.
      We need to upgrade managers for ODE /NGD for the last versions of the physic engines.
      PW

       

      Last edit: Pavel Vassiliev 2022-02-14
  • Sergio

    Sergio - 2022-02-14

    Thanks Pavel I will check.. I could make them to work . The icons are an easy thing . I will check why TGLColorvector was not find. Thanks and regards

     
  • Pavel Vassiliev

    Pavel Vassiliev - 2022-02-15

    Salute Sergio,
    You wrote
    ...I will check why TGLColorvector was not find....
    Please, for development always use only current SVN version of GLScene in trunk. Here it is
    https://sourceforge.net/p/glscene/code/HEAD/tree/trunk/Source/GLS.Color.pas
    and then
    ...I could make them to work ...
    It’s desirable, but before doing that for
    ODE:
    - download ODE-0.16.2 from here at https://bitbucket.org/odedevs/ode/downloads/
    - build with MS Visual Studio 2019/2022 (try to use C++Builder though), combine all needed headers in single file,
    - convert the header to Delphi, compare with our old 0.13 by Beyond Compare,
    - upgrade GLS.ODEManager, ODE ’physics demos and examples in branches.
    NGD:
    - get acquainted with general discussion on NGD forum http://newtondynamics.com/forum/index.php
    - download sources from current git at newton-dynamics/newton-4.00 at master · MADEAPPS/newton-dynamics · GitHub
    - build with MS Visual Studio 2019/2022 (try to use C++builder though) to get binaries as DLLs with the headers to convert to Delphi,
    - be aware of pascal’s conversion at https://github.com/JernejL/NewtonBinaries, that is not suitable for GLScene and outdated,
    - so the new import file must be beyond compared with our old v.2.0 https://sourceforge.net/p/glscene/code/HEAD/tree/trunk/Source/Physics.NGDImport.pas
    and replenished;
    - - upgrade GLS.NGDManager, NGD’physics demos and examples in branches.
    Good luck in this endeavor.
    Then we could upgrade trunks at sourceforge and github.
    Pavel

     
  • Anonymous

    Anonymous - 2022-02-15

    Hi Pavel.
    Really great. Thanks a lot. I will study your suggestions in deep and will comment next week.
    Before this I will post the source of a demo (see figure ) extracted from part of my code. I am just adding some details . I will post the code and the doubts so maybe we can get contributions useful for the forum colleagues. In 2012 I could solve all these points and the big code was working (almost) well. But them I changed many things in other parts. Now I need to adjust the GLScene ODE part. I can do all the basic operations, but it is necessary to know the right combination of values of properties and parameters like velocities, radius of spheres, “ resistance of the joint to rotation”, to achieve what I need. I think you will understand when you see the running code
    Regards and thanks again. Of course, the final result can be posted as a demo if you find useful.
    Sergio

     
  • Anonymous

    Anonymous - 2022-02-15

    The figure I mentioned above

     
  • Sergio

    Sergio - 2022-02-15

    Dont know how to delete 3 lines above that I posted before doing Login

    Hi Pavel.
    Really great. Thanks a lot. I will study your suggestions in deep and will comment next week.
    Before this I will post the source of a demo (see figure ) extracted from part of my code. I am just adding some details . I will post the code and the doubts so maybe we can get contributions useful for the forum colleagues. In 2012 I could solve all these points and the big code was working (almost) well. But them I changed many things in other parts. Now I need to adjust the GLScene ODE part. I can do all the basic operations, but it is necessary to know the right combination of values of properties and parameters like velocities, radius of spheres, “ resistance of the joint to rotation”, to achieve what I need. I think you will understand when you see the running code
    Regards and thanks again. Of course, the final result can be posted as a demo if you find useful.
    Sergio

     
  • Pavel Vassiliev

    Pavel Vassiliev - 2022-02-15

    Sergio,
    What a nice picture for gas molecula motion in the box with a door
    Great.
    PW

     
  • Anonymous

    Anonymous - 2022-02-18

    Hi Pavel .... As mentioned, here is the source code of a demo working (but with failures I need to correct). I found also an interesting old code ( by Eric I think) named IdealGas. I could make it to work. It uses something different of what I use here. I am studying it and will post after..

    THIS CODE, MY OBJECTIVE AND WHAT I NEED TO COMPLETE (after is working well ,if you wish, may add to GLScene demos)

    I have a box with 6 walls. A big number of moving spheres will be created in the closed box before I click the start button. There is also a red ceiling above the wall. The walls (except the yellow-white top) have static behaviors. If the spheres collide with the internal walls they just reflect. If a sphere collide with another sphere it reflects.. In the top there are two flaps with dynamic behaviors. The spheres to be created inside the box will collide and make the flaps to open . I want to do this slower than now. The flaps shall stop after rotating 270°. . When the spheres are going out, but the flaps are semi-closed the spheres collide with them changing the direction. This is an important point for what I need.
    The spheres that go out of the box will reflect in the external ceiling and try to go back to the ground. By gravity and velocity.
    Outside the box there are 4 fixed cubes. If any sphere touch them shall stop there., OBJECTIVES ARE:
    1) To stop the creation of the spheres only if I click the button STOP
    2) To use small (but visible) spheres. Not big spheres as in the IdealGas demo
    3) To make the flaps to open in n easy to observe way. Not so fast nor so slow stopping after 270°
    4) After I click the START button up to the moment I click the STOP button I need to count the number of spheres that are glued in each one of the 4 external cubes . And also the total number of spheres that were created
    Cheers
    Sergio

     
  • Sergio

    Sergio - 2022-02-18

    Hi Pavel ...... As mentioned here is the source code of a demo working (but with failures I need to correct). I found also an interesting old code ( by Eric I think) named IdealGas. I could make it to work. It uses something different of what I use here. I am studying it and will post after..

    THIS CODE, MY OBJECTIVE AND WHAT I NEED TO COMPLETE
    (after is working well ,if you wish, may add to GLScene demos)
    I have a box with 6 walls. A big number of moving spheres will be created in the closed box before I click the start button. There is also a red ceiling above the wall. The walls (except the yellow-white top) have static behaviors. If the spheres collide with the internal walls they just reflect. If a sphere collide with another sphere it reflects.. In the top there are two flaps with dynamic behaviors. The spheres to be created inside the box will collide and make the flaps to open . I want to do this slower than now. The flaps shall stop after rotating 270°. . When the spheres are going out, but the flaps are semi-closed the spheres collide with them changing the direction. This is an important point for what I need.
    The spheres that go out of the box will reflect in the external ceiling and try to go back to the ground. By gravity and velocity.
    Outside the box there are 4 fixed cubes. If any sphere touch them shall stop there.
    MY OBJECTIVES ARE:
    1) To stop the creation of the spheres only if I click the button STOP
    2) To use small (but visible) spheres. Not big spheres as in the IdealGas demo
    3) To make the flaps to open in n easy to observe way. Not so fast nor so slow stopping after 270°
    4) After I click the START button up to the moment I click the STOP button I need to count the number of spheres that are glued in each one of the 4 external cubes . And also the total number of spheres that were created
    Cheers
    Sergio

     
  • Sergio

    Sergio - 2022-02-19

    zipped

     
  • Pavel Vassiliev

    Pavel Vassiliev - 2022-02-19

    Sergio,
    Sorry I don't know how in Brasil but, please, never use the comma for digits in dfms Items.Strings = (
    '0,001'
    '0,004'
    '0,008'
    '0,010'
    '0,02') and so on. (Error at the first appearance of a comma).
    Only points.
    PW

     
  • Sergio

    Sergio - 2022-02-19

    Pavel. Very interesting. I am not used to put points or commas inside group boxes exactly to avoid this kind of problem when writing expressions like
    velocitySphere:= 0.3 * StrToFloat(RGVelocity.items[RGVelocity.itemIndex]);

    However, this cames from an old code where I used commas. If I use commas It works perfectly in my computer . However, if I use points (I tested now) I get immediately the error “1.5 is not a valid floating-point value” . If you are doing improvements on the code use points. If needed, I do the changes for my computer.
    Another subject: I am going deeper in the IdealGas demo. There I see some ways of doing the things better than in this my demo. After finishing I will post also that code here

     
  • Pavel Vassiliev

    Pavel Vassiliev - 2022-02-20

    Ok, Sergio,
    ... I am not used to put points or commas inside group boxes... - there are options for localizations in Windows to change it.
    But I've got another errors while running, see attachments.
    The project needs to be renamed, repared and also remove old Delphi 7 icon and use predefault values in TEdits with lables what it is to be included in branches.
    Be lucky
    Pavel

     
  • Anonymous

    Anonymous - 2022-02-20

    Thanks Pavel. With the help of the IdealGas demo I could get all the results I needed in my big engineering code.. Unfortunately I do not have time to extract what I did there to bring to this smal demo code So lets simply leave this code here .

     
  • Sergio

    Sergio - 2022-02-20

    A sugestion: when we are not logged in we can type an answer like I did one line above but it comes like "anonymous - Post awaiting moderation". I will not repeat what I answered there as I did iun some cases above. I suggest to make impossible to post "anonymous" answers

     

    Last edit: Sergio 2022-02-20
    • Pavel Vassiliev

      Pavel Vassiliev - 2022-02-20

      Yes, it's a soursforge policy that admin have to approve anonymous messages, so it's better to log in before
      Pavel

       
  • Anonymous

    Anonymous - 2022-02-21

    Thanks Pavel . Sure is better to be logged in. The problem is that it is so easy to start writing that sometimes we forget to sign in. The point is , why to accept anonymous things? Regards

     

Anonymous
Anonymous

Add attachments
Cancel