1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Add functions to apply impulse and force to SoftBody on GodotPhysics and JoltPhysics

This commit is contained in:
PiCode
2025-05-13 23:49:28 +03:00
parent 209a446e36
commit fe3aaa2ae3
19 changed files with 303 additions and 0 deletions

View File

@@ -288,6 +288,34 @@ void JoltPhysicsServer3D::area_set_space(RID p_area, RID p_space) {
area->set_space(space);
}
void JoltPhysicsServer3D::soft_body_apply_point_impulse(RID p_body, int p_point_index, const Vector3 &p_impulse) {
JoltSoftBody3D *body = soft_body_owner.get_or_null(p_body);
ERR_FAIL_NULL(body);
body->apply_vertex_impulse(p_point_index, p_impulse);
}
void JoltPhysicsServer3D::soft_body_apply_point_force(RID p_body, int p_point_index, const Vector3 &p_force) {
JoltSoftBody3D *body = soft_body_owner.get_or_null(p_body);
ERR_FAIL_NULL(body);
body->apply_vertex_force(p_point_index, p_force);
}
void JoltPhysicsServer3D::soft_body_apply_central_impulse(RID p_body, const Vector3 &p_impulse) {
JoltSoftBody3D *body = soft_body_owner.get_or_null(p_body);
ERR_FAIL_NULL(body);
body->apply_central_impulse(p_impulse);
}
void JoltPhysicsServer3D::soft_body_apply_central_force(RID p_body, const Vector3 &p_force) {
JoltSoftBody3D *body = soft_body_owner.get_or_null(p_body);
ERR_FAIL_NULL(body);
body->apply_central_force(p_force);
}
RID JoltPhysicsServer3D::area_get_space(RID p_area) const {
const JoltArea3D *area = area_owner.get_or_null(p_area);
ERR_FAIL_NULL_V(area, RID());