orangeduck / Corange

Pure C Game Engine
http://www.youtube.com/watch?v=482GxqTWXtA
Other
1.78k stars 199 forks source link

physics demo #37

Closed blogdron closed 5 years ago

blogdron commented 5 years ago

Click in image to video Physics

Hi, I did a physical demo :D

It is possible to speed up the parallelization greatly, but I did not do this to guarantee the operation of the code

P.S. I wanted to add a collision handler to the boxes, but I didn’t have a mind, it’s hard for me. There, at a minimum, such code is enough to do simple physics for games and handle collisions.

P.P.S. Can you advise code fragments / videos / articles, where in a simple way I can see how to handle box physics? I can not handle the collisions with the boxes: (In vain I skipped math at school many years ago :D

orangeduck commented 5 years ago

Very nice!

It depends exactly what you want to do with the boxes. Here is a basic explaination of how to do axis algined bounding boxes: https://developer.mozilla.org/en-US/docs/Games/Techniques/3D_collision_detection

In general you can use the same approach for non-axis aligned bounding boxes by transforming the colliding object into the local space of the bounding box using its inverse transform.

However if you are interested in physics it might be good to try looking at some stuff from the beginning since building a physics engine is not easy at all.

blogdron commented 5 years ago

Thanks to Daniel for the link, I'll try to figure it out later.And yes, physics is difficult, but I'm a fool so I will try to do it hahah :) A little later, I can still offer a patch for ui_textbox. Now I am trying to implement there at least a flashing cursor, indicating where the input is going, and, as a maximum, a cursor that can be moved around the text and written down to an arbitrary place, if I can do this, I will do a demonstration in which I implement Shadertoy similarity for experimenting with shaders directly from the program, for this I am trying to write some kind of text editor, I still need to think about how to organize code highlighting.

Well, it probably will not be soon :smiley: