• Create Account

Banner advertising on our site currently available from just \$5!

# cold_heats_.--.

Member Since 20 Jun 2012
Offline Last Active Feb 11 2014 02:42 PM

### Predict collision between spheres

21 September 2012 - 02:56 PM

A list of n spheres, each described by the (x,y,z) coordinates of its highest point and ® its radius, is given.
The first sphere starts falling down vertically.If it touches another sphere during the fall , this one also starts to fall down and so on.The trajectory is not modified. The Oz axis is oriented vertically up.Find the number of spheres that will hit the ground.

I know that if it were circles in 2D , the solution would be simple.
I was thinking of projecting each sphere onto the plane determined by the normal of the direction and for each sphere test if its projection collides with the others .However my 3D math is not very good ...
How do I do this ?

### Point-Plane distance

27 August 2012 - 08:59 AM

Hello.
I am following WildBunny's tutorial regarding a simple physics engine :
http://www.wildbunny...es-for-dummies/
However, I have some trouble understanding this part :

"
```for all particles i
{
for all planes j
{
distance = P[i].x*Planes[j].a + P[i].y*Planes[j].b + Planes[j].c;

if (distance < 0)
{
// collision responce
}
}
}```
What this code is doing is finding, by projection, how much of the vector from the plane to the particle is in the direction of the plane normal."

If every particle is determined by its (x,y) point, isn't this a vector from the origin to that point ?

This line :
"distance = P[i].x*Planes[j].a + P[i].y*Planes[j].b + Planes[j].c"
doesnt actually compute the dot product of the origin-point vector and plane normal rather than the plane-point(vector) and normal dot-product?

I drew some sketches so you can see my point.I am testing a particle against the plane who's normal isnt normalized .
[Sorry, I actually mean dot-product , not cross ] .

I know there's a flaw in my reasoning, but I dont seem to get it .

### Some good game design tips?

20 August 2012 - 10:39 AM

Hello.
Untill now , all my designs are a mess.I guess I violate any OOParadigm rule that ever existed.The nightmare starts when I try to add new characteristics.
This is my biggest concern.Right now, I'm not interested in making my code re-usable for other game , rather I'd like to design the code such that adding new features wont be a pain .
I've read articles about design patterns and such , but I fail to understand them [ althought it seems I allready made use of the facade pattern.]
So , are there any good game design "patterns" out there? Could someone help me with some tips?
Maybe articles about design patterns using examples from games would really help.

### [OOP] Two classes that can acces each other's members

28 July 2012 - 04:26 PM

Hello.
Suppose I have two classes : class A and class B .
In my program , A needs to acces some of B's members but B also has to acces some of A's members.
If it's possible, how do I implement this in C++ ?
A and B are separate entities.I do not want to include one of them as a member of the other one .

### Need some advice regarding framerate and char spd

26 July 2012 - 02:14 AM

==I figured it out ===