Rectangles and circles
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Rectangles and circles
Not a game, but if i have time i will do it because i have new ideas.
At the moment, you can play a bit (you manage a ball using mouse):
Get here
And also may be you get new ideas.
At the moment, you can play a bit (you manage a ball using mouse):
Get here
And also may be you get new ideas.
-
- Enthusiast
- Posts: 125
- Joined: Sat Jun 17, 2006 3:15 pm
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
- Michael Vogel
- Addict
- Posts: 2811
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
- Michael Vogel
- Addict
- Posts: 2811
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
My error, I clicked on Get here, got the source text in the browser, selected all text and pasted it into the PB IDE - the "missing" definition is then behind a comment of the previous line...Psychophanta wrote:How? The code is PB4 plug&play! How is it possible?Michael Vogel wrote:I had to add some definitions to get rid of some error messages (PB4)...![]()
The .d is already done in the structures, etc.
Sometimes a fast cut and paste is not the best way...

- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Oops! you are right, that's wierd!
So, just download it to you computer, and then rename to .pb extension instead of .txt one.
(I will never upload a thing without being compressed, grrr).
Thank you Benny and Dare, the best part is not to find it nice, but to know it is a cpu faithful real mechanics simulation.
So, just download it to you computer, and then rename to .pb extension instead of .txt one.
(I will never upload a thing without being compressed, grrr).
Thank you Benny and Dare, the best part is not to find it nice, but to know it is a cpu faithful real mechanics simulation.

- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
I have not such plan, because there is a big difference for real mechanic simulation (which should be fine faithful with the real world) and simulations for games, etc.Cpl.Bator wrote:do you plan to make a library ?![]()
With easy control ?
ex : Make_Bouding_Box(x1,y1,w,l)
I think there is too hard besides of a nonsense to make a lib of funtions for real mechanics simulations for games and general programming. That lib should be good for technical and scientific purposes.
However, the function you mention is already done in the code (it is the heart of all the code)
Code: Select all
ParticleAndBarbellShock(l=0.1,R=0.65,W=0.91,m1=0.3411,m2=0.1411,V1=0.0,V2=0.0,e=1.0,K=/3.0)
R is the half lenght of the barbell.
W is the omega (angular speed) at which the barbell is rotating before collision.
m1: mass of the particle
m2: mass of the barbell
V1: particle linear speed before collision
V2: barbell linear speed before collision (refered to the center of barbell, of course).
e is a constant from 0 to 1 which defines the features of the collision (1 => total elastic: no kinetic energy is transformed in the process; 0 => all the initial kinetic energy is transformed in deformation and heat, and objects don't bound, but after collision it remains stopped one respect to the other). The case of a 2 cars collision would be about an e=0.2 or so; and for billiards would be about e=0.99 . e=1 is an ideal situation.
K is a factor for the Inertial momentum; the factor depends on the geometry of the rotating object [1/3 for a barbell (considering its half-lenght as its radius), 1/3 for a rectangle (considering its half-diagonal as its radius), 1/2 for a disc, 2/5 for a sphere... etc. ].
NOTE that the function outputs the new omega after collision, the new V1 , and the new V2.
As said, that function is the heart of the code, but i had to translate a particle-barbell collision to a particle-rectangle collision, that is: GoParticleAndBarbell(). And that's what really caused me hard pain and headache. But finally i did it.
EDIT: After all, besides of all, you need to tell to the box what are the items which will collide with it and what aren't; you need to detect the collision, which is easy but large; you should give certain properties for the collision to the box; etc.
Thus, you have the code, which is a good resource to do things

Ok, thanks.
Do you have a good link for 2D games physics ? , because i'm interesting for (re)make my pseudo "Sonic" game.
I've already start it, but , physics blocks me at coding...
Oct05-Sonic demo
I don't want use an "prefab engine"
Do you have a good link for 2D games physics ? , because i'm interesting for (re)make my pseudo "Sonic" game.
I've already start it, but , physics blocks me at coding...

Oct05-Sonic demo
I don't want use an "prefab engine"