Give me a Pixel's Forum Posts

  • I integrated your example into mine and it worked perfectly. You're a genius, thanks so much!

  • Hello,

    I've been wanting to design a game with a destructible voxel world with physics. I want there to be a custom voxel world, and explosions will take out voxels. Easy. The hard part is preventing floating chunks of voxels (meaning voxels that are not attached to the ground). I have created a demo of the voxel function, but it has a few flaws that I will talk about later.

    But here is essentially how I went about designing this demo. All the voxels initially have physics, but have 'immovable' checked in order to prevent them from moving and keep performance acceptable. When there is an explosion, all voxels in a certain range get 'immovable' unchecked and impulse away from the explosion. Then a voxel update is called.

    When the game is called to update the world, the game first set s all voxels 'IsOnGround' instance variable to false, then checks to see which ones need to be true. It first checks all of the voxels connected to the ground and sets their 'IsOnGround' to true. Each of these checks the four positions immediately around it, and if there is a voxel in those positions, the process is repeated for each of them. This is visualized in my demo by the red and blue colors each voxel is set to. This works very well, although it is somewhat slow as not to overload the computer.

    The part I have trouble with is collapsing the voxels that still have their 'IsOnGround' variable to false after the check. The only way I could think of is having a sprite check each row a few seconds after the update check is called. When the sprite overlaps a voxel, it checks the voxel to see if the voxel's 'IsOnGround' is true or false, collapsing the voxels that are false. This sprite is the red bar that moves across the screen in my demo.

    This works but has a few issues. It is slow, as floating voxels will not be collapse until a few seconds after the update. The other issue is that when dealing with complex shapes, the checking may not have time to complete before the sprite comes and collapsed voxels. The final issue is when explosions occur before the first explosion checking is complete, which could mess up the whole system.

    Here is the demo file: https://www.dropbox.com/s/9889wxtjayvdyhv/Voxel%20Physics.c3p?dl=0

    Do you have any ideas on how to collapse the voxels that are not attached to the ground?

    Thanks in advance,

    Give me a Pixel

  • You do not have permission to view this post

  • Not me, sorry. I don't have social media.

  • Ok, I used that formula and made it work. Thanks again.

  • I compared them in the debugger and couldn't really figure out how that would work. Are there any other methods?

  • dop2000

    That is a pretty good example. How can I tell if the car is moving backwards or not? I need that because the left and right steering will have to be reversed while the car is moving backwards. But anyway, that is definitely a good start. Thanks again.

  • Thank you, I will check it out.

  • Is it possible? I will help in any way I can.

  • dop2000

    Is it for Construct 3? I don't use C2.

  • I found the Construct 2 car physics plugin on GitHub. I also found the source. Can somebody PLEASE help me turn this into a plugin? Here is the source code: github.com/qertis/c2-car-physics

  • Ok guys, I recently did some searches for doing top down car physics and found some results. Unfortunately, they are in JavaScript or some coding language which I do not know. I really need the kill lateral velocity part, which basically gives the wheels 'friction' so they can only move forward in the direction they are facing. You can read more about it in the sites I found. Can somebody translate this into Events?

    Here are the websites:

    github.com/domasx2/gamejs-box2d-car-example

    emanueleferonato.com/2009/04/06/two-ways-to-make-box2d-cars

    iforce2d.net/b2dtut/top-down-car

    Thanks in advance, I really want good top down car physics so I can make a new version of Cops and Robbers.

  • Cool, thank you.

  • Thanks again guys, you were both VERY helpful :)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you! I will certainly check it out!