Skip to content

Commit

Permalink
Update SoftBodyMotionProperties.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
PiCode9560 committed Dec 27, 2024
1 parent 761309f commit 988161d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions modules/jolt_physics/objects/jolt_soft_body_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,6 @@ void JoltSoftBody3D::apply_central_force(const Vector3 &p_force) {
return;
}

wake_up();

JPH::BodyInterface &body_iface = space->get_body_iface();

const JPH::Vec3 force = to_jolt(p_force);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ void SoftBodyMotionProperties::IntegratePositions(const SoftBodyUpdateContext &i

// Integrate
Vec3 sub_step_gravity = inContext.mGravity * dt;
Vec3 sub_step_impulse = GetAccumulatedForce() * dt;
Vec3 sub_step_impulse = GetAccumulatedForce() * dt / max(float(mVertices.size()), 1.0f);
for (Vertex &v : mVertices)
if (v.mInvMass > 0.0f)
{
Expand Down Expand Up @@ -765,7 +765,7 @@ void SoftBodyMotionProperties::UpdateSoftBodyState(SoftBodyUpdateContext &ioCont

// Calculate linear/angular velocity of the body by averaging all vertices and bringing the value to world space
float num_vertices_divider = float(max(int(mVertices.size()), 1));
SetLinearVelocity(ioContext.mCenterOfMassTransform.Multiply3x3(linear_velocity / num_vertices_divider));
SetLinearVelocityClamped(ioContext.mCenterOfMassTransform.Multiply3x3(linear_velocity / num_vertices_divider));
SetAngularVelocity(ioContext.mCenterOfMassTransform.Multiply3x3(angular_velocity / num_vertices_divider));

if (mUpdatePosition)
Expand Down

0 comments on commit 988161d

Please sign in to comment.