Erwin Coumans wrote:
If it is not clear, I should make the demo more obvious.
The convex cast (==sweep) demo performs time of impact between two linear moving objects, objectA and objectB. Each objects has a starting position (fromA/fromB) and an ending position (toA/toB), both in worldspace. Then internally, the SubsimplexCast algorithm converts this into minkowski space. That's where the intuition usually starts failing. However, this calculation can also be performed in world space. See the ContinuousConvexCollision (
http://www.continuousphysics.com/Bullet ... tml#l00040 ). If you ignore the rotation, you can see the concept and how 'fromA and fromB' are processed. The other version just transforms things into 'relative' MinkowskiSpace.
In the case of raycasting against a convex object, the ray is represented as a moving sphere. Both this sphere and the convex are passed into the routine to find the hitpoint/fraction/normal.
Erwin
Okay, I think I see what fromA and toA are. fromA is the current object position (A.getPosition()) and toA is the final position at the next point in time (A.getPosition() + A.getVelocity()). Then your calculateVelocity function takes toA - fromA = (A.getPosition() + A.getVelocity()) - A.getPosition() = A.getVelocity().
Aside from the conversion from world to minkowski space that you mentioned, Gino's algorithm seems a little bit easier to implement. Before setting the values of s and r, you seem to do some sort of transformations with fromA/toA and fromB/toB
Code: Select all
rayFromLocalA = fromA.inverse()* fromB;
rayToLocalA = toA.inverse()* toB;
It seems like your postitions are specified as matrices then you take the inverse of one and multiply it by the other? I guess what I would like to know is, can the vectors s and r be specified somehow using position/velocity vectors of the two objects A and B(as offsets from world origin [0,0,0]) together with simple operations such as addition, subtraction, cross and dot products?
As an example:
Update accel/vel/pos until contact.
A is a sphere radius 10.
A.getPosition() = [0, 50, 0]
A.getVelocity() = [0, 0, 0]
A.getAcceleration() = [0, -9.8, 0]
B is a sphere radius 10.
B.getPosition() = [0, 0, 0]
B.getVelocity() = [0, 0, 0]
B.getAcceleration() = [0, 0, 0]
Resulting contact point should be approx [0, 10, 0] with normal [0, 1, 0].
Does lambda in this algortihm have to lie between 0..1 ?
Thats is basically all of the information I have to work with currently.
Maybe I'm expecting a simple solution to this that just doesn't exist...
Thanks for your patience with me
