Jump to content
  • Advertisement

Dirk Gregorius

Member
  • Content count

    1063
  • Joined

  • Last visited

  • Days Won

    1

Dirk Gregorius last won the day on April 21

Dirk Gregorius had the most liked content!

Community Reputation

2797 Excellent

3 Followers

About Dirk Gregorius

  • Rank
    Contributor

Personal Information

  • Role
    Programmer
  • Interests
    Business
    Programming

Recent Profile Visitors

13012 profile views
  1. Dirk Gregorius

    Updating Orientation with Angular Velocity

    Sorry, I don't understand what you are talking about.
  2. Dirk Gregorius

    Updating Orientation with Angular Velocity

    This effect comes from integrating the torques, not the angular velocity. E.g. I * omega' = tau - omega x ( I * omega ) The omega x ( I * omega ) term describes the rotation of the inertia tensor and gyroscopic effects. In physics engine it is often dropped due to stability issues, but this can be solved easily.
  3. Dirk Gregorius

    Conservation of Angular Momentum

    In a physics engine you would mark the wall as static. This would set the mass of the wall internally to *infinite* which means that the *inverse* mass (1/mass) will be zero. Similarly the inverse inertia will be the zero *matrix*. If you look at your formulas you only need the *inverse* of mass and inertia. So just plug zero and zero matrix into the formulas. This will also work when you apply the impulse, but you can also simply skip.
  4. Dirk Gregorius

    Conservation of Angular Momentum

    I really like this explanation: http://essentialmath.com/AngularImpulse.pdf
  5. Dirk Gregorius

    3D Manifold Collision Response

    You don't apply the same impulse every time. For each iteration at every manifold point you apply equal and opposite impulses such that the relative post velocity at the manifold point will be zero. Here relative post velocity means the relative velocity at the manifold point in the direction of the manifold normal *after* you applied the impulse.
  6. Dirk Gregorius

    Car physics ?

    While you're at it. I would appreciate a private post as well if you don't mind to share :)
  7. Dirk Gregorius

    Set faces to face outside of 3d convex shape

    How can a center point be outside a convex shape? There are many ways to compute an interior point. You build the AABB and use its center. This has edge cases where the interior point can lie on the surface. You can build the average of all vertices. You can use the center of mass.
  8. Dirk Gregorius

    Set faces to face outside of 3d convex shape

    I use the center point. For which weird shapes it is not working for you. Do you have an example?
  9. Dirk Gregorius

    Collision Detection - why GJK?

    This might be actually useful for warm-starting in the impulse based systems. How did you re-distribute the energy? I assume you would redistribute in a way that the net forces on the associated bodies are relatively stable between frames?
  10. You can just build the Minkowski sum of the two boxes and then raycast against this. E.g. add the half extents of the dynamic box to the static box and then raycast from the center of the dynamic box in the direction of the velocity time the timestep against the inflated box.
  11. Dirk Gregorius

    Modeling restitution

    This is a good discussion of the problem: http://www.cs.columbia.edu/cg/rosi/ In a nutshell there exist two collision/contact models I am aware of: simultaneous and sequential. For the Newton Craddle you need to propagate velocity sequentially in the right order to get the right behavior. It is probably something I would investigate for a pool game. For everything else simultaneous contact is really a good choice from my experience. Note the sequential impulses are really a simultaneous model since it solves the LCP formulation of the problem. It does not sequentially propagate velocity as the name might (incorrectly) suggest.
  12. Dirk Gregorius

    3D Manifold Collision Response

    I tried this very long time ago. I built a weighted center though. Each manifold was weighted by it relative velocity to pull the point towards where the action is. It was good for some cases, but it is not a general solution. GameDev is about good decision making and scoping. You can use a physics engine and would not need to worry about any of the technical problems at all. There will be some time to familiarize yourself with the physics engine, but it will be in the order of a few weeks and not months with a lot of risk of failing.
  13. Dirk Gregorius

    3D Manifold Collision Response

    I fixed the links and paste my code for computing inertia. Then you don't need to worry about the math too much. struct RnMassProperties { float Mass; RnMatrix3 Inertia; RnVector3 Center; }; RnMassProperties RnHullShape::ComputeMassProperties( float Density ) const { // M. Kallay - "Computing the Moment of Inertia of a Solid Defined by a Triangle Mesh" float Volume = 0.0f; RnVector3 Center = RN_VEC3_ZERO; float XX = 0.0f; float XY = 0.0f; float YY = 0.0f; float XZ = 0.0f; float ZZ = 0.0f; float YZ = 0.0f; // Iterate over faces and triangulate in-place for ( int I = 0; I < mHull->FaceCount; ++I ) { const RnFace* Face = mHull->GetFace( I ); const RnHalfEdge* Edge1 = mHull->GetEdge( Face->Edge ); const RnHalfEdge* Edge2 = mHull->GetEdge( Edge1->Next ); const RnHalfEdge* Edge3 = mHull->GetEdge( Edge2->Next ); RN_ASSERT( Edge1 != Edge3 ); RnVector3 V1 = mHull->GetVertex( Edge1->Origin ); do { RnVector3 V2 = mHull->GetVertex( Edge2->Origin ); RnVector3 V3 = mHull->GetVertex( Edge3->Origin ); // Signed volume of this tetrahedron float Det = rnDet( V1, V2, V3 ); // Contribution to mass Volume += Det; // Contribution to centroid RnVector3 V4 = V1 + V2 + V3; Center += Det * V4; // Contribution to inertia monomials XX += Det * ( V1.X * V1.X + V2.X * V2.X + V3.X * V3.X + V4.X * V4.X ); YY += Det * ( V1.Y * V1.Y + V2.Y * V2.Y + V3.Y * V3.Y + V4.Y * V4.Y ); ZZ += Det * ( V1.Z * V1.Z + V2.Z * V2.Z + V3.Z * V3.Z + V4.Z * V4.Z ); XY += Det * ( V1.X * V1.Y + V2.X * V2.Y + V3.X * V3.Y + V4.X * V4.Y ); XZ += Det * ( V1.X * V1.Z + V2.X * V2.Z + V3.X * V3.Z + V4.X * V4.Z ); YZ += Det * ( V1.Y * V1.Z + V2.Y * V2.Z + V3.Y * V3.Z + V4.Y * V4.Z ); Edge2 = Edge3; Edge3 = mHull->GetEdge( Edge3->Next ); } while ( Edge1 != Edge3 ); } RN_ASSERT( Volume > 0.0f ); // Fetch result RnMatrix3 Inertia; Inertia.C1.X = YY + ZZ; Inertia.C2.X = -XY; Inertia.C3.X = -XZ; Inertia.C1.Y = -XY; Inertia.C2.Y = XX + ZZ; Inertia.C3.Y = -YZ; Inertia.C1.Z = -XZ; Inertia.C2.Z = -YZ; Inertia.C3.Z = XX + YY; RnMassProperties Out; Out.Mass = Density * Volume / 6.0f; Out.Center = Center / ( 4.0f * Volume ); Out.Inertia = ( Density / 120.0f ) * Inertia; return Out; } Note that the inertia is relative to the origin. You can shift the inertia to the center of mass using the Parallel Axis Theorem: https://en.wikipedia.org/wiki/Parallel_axis_theorem Here is some helper code: // Inertia helper RnMatrix3 rnSteiner( float Mass, const RnVector3& Origin ) { // Usage: Io = Ic + Is and Ic = Io - Is float Ixx = Mass * ( Origin.Y * Origin.Y + Origin.Z * Origin.Z ); float Iyy = Mass * ( Origin.X * Origin.X + Origin.Z * Origin.Z ); float Izz = Mass * ( Origin.X * Origin.X + Origin.Y * Origin.Y ); float Ixy = -Mass * Origin.X * Origin.Y; float Ixz = -Mass * Origin.X * Origin.Z; float Iyz = -Mass * Origin.Y * Origin.Z; // Write RnMatrix3 Out; Out.C1.X = Ixx; Out.C2.X = Ixy; Out.C3.X = Ixz; Out.C1.Y = Ixy; Out.C2.Y = Iyy; Out.C3.Y = Iyz; Out.C1.Z = Ixz; Out.C2.Z = Iyz; Out.C3.Z = Izz; return Out; } E.g. to shift the mass to the center use Inertia -= rnSteiner( Mass, Center );
  14. Dirk Gregorius

    3D Manifold Collision Response

    There are a bunch of publications on this topic. Here are some references: Mirtich: https://people.eecs.berkeley.edu/~jfc/mirtich/massProps.html Eberly: https://www.geometrictools.com/Documentation/PolyhedralMassProperties.pdf Blow: http://number-none.com/blow/inertia/index.html Personally I use this method: Kallay: https://www.tandfonline.com/doi/abs/10.1080/2151237X.2006.10129220#.Ukr1ZoakqGc I think Stan Melax wrote about this as well, but I cannot find a link right now. Maybe Randy has one...
  15. Dirk Gregorius

    Creating 3D Collision Point

    You can use SAT for just overlap testing. GJK would work as well. There is a special boolean SAT-GJK version of the original GJK which just searches for a separating axis (as opposed to the original GJK which computes the closest points between disjoint convex shapes) and reports only whether two shapes overlap . This is what I use. There is an example of the SAT-GJK in Gino's book. Also the often mentioned Mollyrocket GJK video actually describes the boolean SAT-GJK and not the original (closest point) GJK. Yes, that will work as well. You can always optimize this later. It will be O(n^2) or even O(n^3) without the GM though.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!