Devination / VerletKha

A simple 2D Verlet physics engine written in Haxe and Kha. Port of verlet-js.
http://www.devination.com/p/verletkha.html
MIT License
41 stars 4 forks source link

[REQUEST] disable borders #6

Closed lewislepton closed 8 years ago

lewislepton commented 8 years ago

it would be great if you could actually take away the borders, so shapes, such as the tire, box etc can pass the left, right and bottom borders.

a disable option would be cool ;)

Devination commented 8 years ago

This is now possible with [c326068] with the addition of pos to the Verlet World. You can now offset the Verlet World's position from the render screen.

I would recommend pushing your borders out for a bit of buffer room with something like this: new Verlet(screenWidth + aBitX, screenHeight + aBitY, false, -aBitX, -aBitY);

Though if you want to fully remove the borders (not recommended) you could do something like this: new Verlet(Math.POSITIVE_INFINITY, Math.POSITIVE_INFINITY, false, Math.NEGATIVE_INFINITY, Math.NEGATIVE_INFINITY);

Be warned: If you remove the borders your simulations could start getting into some crazy large numbers and start tanking performance if you have a lot of stuff floating far in space for too long.