Path: blob/master/thirdparty/jolt_physics/Jolt/Physics/SoftBody/SoftBodyVertex.h
9912 views
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)1// SPDX-FileCopyrightText: 2023 Jorrit Rouwe2// SPDX-License-Identifier: MIT34#pragma once56#include <Jolt/Geometry/Plane.h>78JPH_NAMESPACE_BEGIN910/// Run time information for a single particle of a soft body11/// Note that at run-time you should only modify the inverse mass and/or velocity of a vertex to control the soft body.12/// Modifying the position can lead to missed collisions.13/// The other members are used internally by the soft body solver.14class SoftBodyVertex15{16public:17/// Reset collision information to prepare for a new collision check18inline void ResetCollision()19{20mLargestPenetration = -FLT_MAX;21mCollidingShapeIndex = -1;22mHasContact = false;23}2425Vec3 mPreviousPosition; ///< Internal use only. Position at the previous time step26Vec3 mPosition; ///< Position, relative to the center of mass of the soft body27Vec3 mVelocity; ///< Velocity, relative to the center of mass of the soft body28Plane mCollisionPlane; ///< Internal use only. Nearest collision plane, relative to the center of mass of the soft body29int mCollidingShapeIndex; ///< Internal use only. Index in the colliding shapes list of the body we may collide with30bool mHasContact; ///< True if the vertex has collided with anything in the last update31float mLargestPenetration; ///< Internal use only. Used while finding the collision plane, stores the largest penetration found so far32float mInvMass; ///< Inverse mass (1 / mass)33};3435JPH_NAMESPACE_END363738