Ive made a project called physics engine and there is, well, physics. It is my first time doing something like this and it of course is not perfect, its just a block bouncing around, but i will soon try make a different engine, Physics engine 2.0 where you can place blocks, throw block, and make blocks collide with each other. :)))
can you please post the link?
as i said, dont expect much, its just a block bouncing around but i will make drastic improvements from practice
Welcome to Snap! and the forum!
Very cool. I put the project in turbo mode (shift-click the green flag) to see whether the block would slow down over time without having to wait a long time, and I noticed that it did indeed bounce lower and lower. Eventually, however, it reached an equilibrium and kept repeating the same, bouncy, mesmerizing pattern over and over again.
i actually did notice that and what i feel like i need to do it just increase the gravity just a wee bit like -0.3 and try decrease the speed of the bounce. my next version will be an interactive version of it so stay tuned !!!!
thanks a lot brother!
Add some friction i.e. something like Vx=Vx * 0.99, Vy=Vy*0.99
thats exactly what i was gonna do, thats the reason i was gonna hop on the project again, and thanks for the code for friction :)))
New additions, added friction (i feel like its too strong ill try find a new way to tweak that and thanks to @dardoro for the friction script) also added so that you can drag the block and throw it around based on the speed of your cursor :)))
I love this project. Some nyeleneh bugs:
- If you press space, it creates a new clone right? But these clones are not controlled individually, so all clones are in the same position. I guess you should only do this "for this sprite only".
- Also, more clones = more gravity.
- Sometimes they get stuck when it bounes too much.
- And instead of making one clone per press, it doubles the amount of clones, making them lag and eventually reach the 5,000 clone limit. See this for more information.
You can try to fix these bugs if you can.
So tweak the friction coefficient toward 1 until you feel it is OK. For me, 0.997 feels good, but it's your world
For more accurate results the friction depends on V^2 => V = V-V^2*C_x*A
C_x - drag coefficient, depending on shape and material
A - area of the shape
Depending on how accurate should be your simulation you may take into account other aspects like shape or Reynolda number Drag (physics) - Wikipedia
For games, the simplest and sometimes unreal effects may be more fun.