Results 1 to 8 of 8

Thread: How do you check collision ?

  1. #1
    Member DirectuX's Avatar
    Join Date
    Oct 2018
    Location
    France
    Posts
    417
    Rep Power
    55

    Question How do you check collision ?

    Hi,

    regarding this old 2009 post #5 and subsequent #6. Today, how would you check for collision between a 3d triangle (poly) and other geometry (triangle, quad or box) ?
    ( 20 ~ 100+ entity, 60fps)
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

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

    I remember those times, I started working on collision library, but then I decided it was not good idea to bloat TBGL further.

    As of today, I think it would be the best to create dedicated collision module - or #compiled booster at least.


    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
    Member DirectuX's Avatar
    Join Date
    Oct 2018
    Location
    France
    Posts
    417
    Rep Power
    55
    Quote Originally Posted by Petr Schreiber View Post
    As of today, I think it would be the best to create dedicated collision module - or #compiled booster at least.
    can't this be done by the gpu ?
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  4. #4
    Hi DirectuX
    there is a collision engine posted here some time ago, the 2 examples are for cubes, but the *.inc file contains a sphere and other shapes, i haven't checked it more
    https://www.thinbasic.com/community/...rcial-license)
    here is a one week link
    http://wikisend.com/download/996384/TB_TrueAxis.zip

    edit: i checked the package with virusTotal and it is fully clean.
    edit2: don't know if you know about xord3d (abandonware) , since i have posted here http://www.thinbasic.com/community/s...l-with-physics in a mediafire link a full package containing a spiral and a knot and when you press 'W' you see the meshes in wire mode and there is a sphere rolling inside the tubes. a collision between the sphere and inside the tubes.
    Last edited by primo; 24-12-2019 at 15:09.

  5. #5
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736
    can't this be done by the gpu ?
    Sure, what I wrote does not contradict that Both module and #compiled can use for example OpenCL or Vulkan. But I would suggest to make it optional - the presence of support for both technologies is not guaranteed on non-gaming rigs.


    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

  6. #6
    Member DirectuX's Avatar
    Join Date
    Oct 2018
    Location
    France
    Posts
    417
    Rep Power
    55
    Hi,

    @Primo, thanks, I'll have a look soon !
    @Petr, remember about ArrayFire ? It comes with a CPU fallback too !
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  7. #7
    Member DirectuX's Avatar
    Join Date
    Oct 2018
    Location
    France
    Posts
    417
    Rep Power
    55

    Question

    Well,



    For the context of this thread : I was looking for a light answer, more of a thinBasic & TBGL dialect. So: both of the previous suggestions, despite being attractive, are of excessive power. Therefore, I'll try with TBGL_PointInside3D and overlapping %TBGL_OBJ_CUBE shapes and if it gives nothing good, I'll keep my idea for later.



    For the subject of a collision module, I think this should not be launched savagely but rather with community's needs or not discussion and weighted according to the time resources each will be willing to share for such project. Thinking further on that, I don't think I am willing to engage in a big work on this yet.

    or #compiled booster at least.
    Would this be pertinent, compared to a (very) light module ?



    What I think a collision module should be able. (Please discuss this) That's a quick thought. Do you think these 4 functionality would suffice to extend to all other collision-only functionality ?

    Something near to TBGL_PointInside3D but working with lists.

    1. Input n lists of triangles.
      Return which triangle of which list intersects with which other triangles of which list (including self)
    2. Input n lists of triangles as closed volumes
      Input n2 lists of 3D points
      Return which point of which list is inside which volume.
    3. Input n lists of triangles as surfaces
      Input n2 lists of 3D points as lines
      Return which segment of which list crosses which triangle.
    4. Possibly return shortest distance between each lists
    Last edited by DirectuX; 28-12-2019 at 23:29. Reason: added links to inside forum
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  8. #8
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736
    Hi,

    I also think using already existing library/technology is wise. The benefit of creating something from scratch has high educational value, but from practical point of view, thinBasic include file with declares for already existing solution (prefferably "in active development") would make most sense

    As for #compiled approach - again, it would have great educational value, could reveal some challenging parts of thinBASIC/FreeBASIC interop. That would be the main and primary benefit.

    If one needs something to get the job done for a specific project, we really should look at already existing, actively maintained library and make it accessible from TB.


    Petr
    Last edited by Petr Schreiber; 31-12-2019 at 16:02.
    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

Similar Threads

  1. Control set check
    By Michael Clease in forum Fixed or cleared errors in help material
    Replies: 1
    Last Post: 07-02-2010, 13:02
  2. TBGL sprite collision; I want to tune the box2circle collision a bit
    By Michael Hartlef in forum TBGL module by Petr Schreiber
    Replies: 3
    Last Post: 31-07-2009, 23:36
  3. Check internet connection
    By ErosOlmi in forum Internet related scripts
    Replies: 7
    Last Post: 22-03-2007, 05:37
  4. Do you need to check internet connection?
    By ErosOlmi in forum Sources, Templates, Code Snippets, Tips and Tricks, Do you know ...
    Replies: 0
    Last Post: 16-10-2006, 10:45
  5. Master data check
    By ErosOlmi in forum Real world situations and solutions using thinBasic
    Replies: 0
    Last Post: 09-10-2006, 16:55

Members who have read this thread: 0

There are no members to list at the moment.

Tags for this Thread

Posting Permissions

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