SoftBodyVertex.h 1.2 KB

123456789101112131415161718192021222324252627
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2023 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. #include <Jolt/Geometry/Plane.h>
  6. JPH_NAMESPACE_BEGIN
  7. /// Run time information for a single particle of a soft body
  8. /// Note that at run-time you should only modify the inverse mass and/or velocity of a vertex to control the soft body.
  9. /// Modifying the position can lead to missed collisions.
  10. /// The other members are used internally by the soft body solver.
  11. class SoftBodyVertex
  12. {
  13. public:
  14. Vec3 mPreviousPosition; ///< Position at the previous time step
  15. Vec3 mPosition; ///< Position, relative to the center of mass of the soft body
  16. Vec3 mVelocity; ///< Velocity, relative to the center of mass of the soft body
  17. Plane mCollisionPlane; ///< Nearest collision plane, relative to the center of mass of the soft body
  18. int mCollidingShapeIndex; ///< Index in the colliding shapes list of the body we may collide with
  19. float mLargestPenetration; ///< Used while finding the collision plane, stores the largest penetration found so far
  20. float mInvMass; ///< Inverse mass (1 / mass)
  21. };
  22. JPH_NAMESPACE_END