Jump to content

  • Log In with Google      Sign In   
  • Create Account

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

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 29 Mar 2012
Offline Last Active Feb 23 2015 08:52 AM

Topics I've Started

Moving capsule and ball intersection?

11 February 2015 - 09:42 AM

How do i calculate the time / intersection point for a moving ball against a moving capsule?


I know using the minkowski sum, i can shrink down the moving ball (which forms a capsule) to a line segment and add the balls radius to the other shape. This method will work fine for moving against static, but not if both are moving...


Any one an idea?




Predicted position collision impulse

01 February 2015 - 12:49 PM

Hi there,

i have a particle simulation which uses predicted position to compute the contact points which are instanly solved using a simple projection method right now. This works fine, but there is no bounce or friction at all, but its much more natural if there are at least some sort of bounce and friction and thats the part i am trying to figure out. Unfortunatly the methods i know does not work very well, there is no change at all or the result is invalid, like the particles are falling through the ground or something like that, or is not change at all.


Does anyone know how to deal with restitution and friction in simulations which uses the "predicted position" and "previous position" on every frame for solving the collisions? It looks a bit like verlet integration, but its not the same.


Here is the code for projection the particles against some fixtures - in this part just a circle fixture:

CircleShape circle = (CircleShape) shape;
Vec2f circlePos = new Vec2f(bodyPos.x, bodyPos.y);
Vec2f d = predictedPosition.sub(circlePos);
float lenSq = d.lengthSquared();
float radiusSum = circle.getRadius() + particleRadius;
if (lenSq < radiusSum * radiusSum) {
	float len = (float) Math.sqrt(lenSq);
	Vec2f n;
	if (len == 0) {
	        len = 1;
		n = new Vec2f(1f, 0f);
	} else {
		n = d.div(len);
	float penetration = len - radiusSum;

	// TODO: Calculate velocity impulse for particle
	// Vn = N * (V dot N)
	// Vt = V - Vn
	// Vec2f Vn =  n.mult(v.dot(n));
	// Vec2f Vt = v.sub(Vn);

	// Calculate final projection point

I have a buffer of prediction position and a buffer of last position.

The prediction position are calculated at the start of the simulation to simply force integration like this:

int index = activeParticles[i];
velocityBuffer[index] += forceBuffer[index] * particles[index].invMass * DT;
predictedPositionBuffer[index] = positionBuffer[index] + velocityBuffer[index] * DT;

And of course the final velocity is re-calculated after the simulation like this:

velocityBuffer[index] = (predictedPositionBuffer[index] - positionBuffer[index]) / DT;

Does anyone have some idea?

[Solved] Transform 3D Cross Vec to 2D Cross Vec

18 January 2015 - 02:35 PM

I have a cross product function in a paper like this:


F = N x W - where V are a 3D Vector as result (later used as an addition to another vector)


How do i handle this type in 2D?

Using zero as Z-value for a normal 3D Cross operations results in a (0, 0, z) vector - therefore this does not work.


If one component was a scalar instead of a vector, i could just compute the perpendicular scaled by the scalar to achieve the same result.




[Solved] Position based fluid implementation - help needed

14 January 2015 - 04:36 PM

I am in the process of implementing the math of the following paper (Position Based Fluid) with java, but have still trouble following the paper and are confused about some formulas. And yes i dont have any math professional backgrunds at all, so calculus, differential equations are out of my league but still i really want to implement this paper - my entire game concept is based on fluid dynamics, but there are no existing physics engine which fits my requirements.


Here some part of formulas from the right side of page 2:





Can you please help me to break this down - so that a non math-professionals understand it?


Especially in equation (9) what is the sum of k? Sum over all neighbor particles where every neightbor index is called k and the sum is incremented for every result of the formula "gradient p k c i"?

The two vertical lines between some symbols mean scalar right?

The symbol "pk" after the gradient and before the W confuse me a lot.


I already have implemented the density estimator (p i) and the density constraint (C i) and have all 2 kernels (poly 6 and spiky gradient).


Of course there is much more, but i want to do it step by step.


Thanks in regards,



Its a shame that i never had the chance to study calculus and all that math stuff.

What is the gradient symbol for

12 January 2015 - 01:45 PM

Hi am currently breaking down a paper called "Position Based Fluid" and have trouble understanding some symbols.

First off, i dont have any math professional backgrounds at all - i barely understand the basics to break down some formulas but if these gets too complex and i dont have any chance to convert this code.


There is a kernel function for calculation a approximation value based on the difference between two particles - called smoothing function which does some magic math stuff behind, like transforming the distance between two particles into the range of the kernel h with some smoothing...


There are two variants of this formula, one normal and one for gradient:






What are the differerence between those?


I know that delta.png means "Change in" and i also found out that the flipped symbol gradient.png means gradient but i have no clue what this are.


Please help me to break this down.


Thanks and regards,