Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/jolt_physics/Jolt/Physics/SoftBody/SoftBodyVertex.h
9912 views
1
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2
// SPDX-FileCopyrightText: 2023 Jorrit Rouwe
3
// SPDX-License-Identifier: MIT
4
5
#pragma once
6
7
#include <Jolt/Geometry/Plane.h>
8
9
JPH_NAMESPACE_BEGIN
10
11
/// Run time information for a single particle of a soft body
12
/// Note that at run-time you should only modify the inverse mass and/or velocity of a vertex to control the soft body.
13
/// Modifying the position can lead to missed collisions.
14
/// The other members are used internally by the soft body solver.
15
class SoftBodyVertex
16
{
17
public:
18
/// Reset collision information to prepare for a new collision check
19
inline void ResetCollision()
20
{
21
mLargestPenetration = -FLT_MAX;
22
mCollidingShapeIndex = -1;
23
mHasContact = false;
24
}
25
26
Vec3 mPreviousPosition; ///< Internal use only. Position at the previous time step
27
Vec3 mPosition; ///< Position, relative to the center of mass of the soft body
28
Vec3 mVelocity; ///< Velocity, relative to the center of mass of the soft body
29
Plane mCollisionPlane; ///< Internal use only. Nearest collision plane, relative to the center of mass of the soft body
30
int mCollidingShapeIndex; ///< Internal use only. Index in the colliding shapes list of the body we may collide with
31
bool mHasContact; ///< True if the vertex has collided with anything in the last update
32
float mLargestPenetration; ///< Internal use only. Used while finding the collision plane, stores the largest penetration found so far
33
float mInvMass; ///< Inverse mass (1 / mass)
34
};
35
36
JPH_NAMESPACE_END
37
38