feat: modules moved and engine moved to submodule

This commit is contained in:
Jan van der Weide 2025-04-12 18:40:44 +02:00
parent dfb5e645cd
commit c33d2130cc
5136 changed files with 225275 additions and 64485 deletions

View file

@ -1,5 +1,5 @@
def can_build(env, platform):
return not env["disable_3d"]
return not env["disable_physics_3d"]
def configure(env):

View file

@ -28,13 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GJK_EPA_H
#define GJK_EPA_H
#pragma once
#include "godot_collision_solver_3d.h"
#include "godot_shape_3d.h"
bool gjk_epa_calculate_penetration(const GodotShape3D *p_shape_A, const Transform3D &p_transform_A, const GodotShape3D *p_shape_B, const Transform3D &p_transform_B, GodotCollisionSolver3D::CallbackResult p_result_callback, void *p_userdata, bool p_swap = false, real_t p_margin_A = 0.0, real_t p_margin_B = 0.0);
bool gjk_epa_calculate_distance(const GodotShape3D *p_shape_A, const Transform3D &p_transform_A, const GodotShape3D *p_shape_B, const Transform3D &p_transform_B, Vector3 &r_result_A, Vector3 &r_result_B);
#endif // GJK_EPA_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_AREA_3D_H
#define GODOT_AREA_3D_H
#pragma once
#include "godot_collision_object_3d.h"
@ -236,5 +235,3 @@ struct AreaCMP {
refCount = 1;
}
};
#endif // GODOT_AREA_3D_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_AREA_PAIR_3D_H
#define GODOT_AREA_PAIR_3D_H
#pragma once
#include "godot_area_3d.h"
#include "godot_body_3d.h"
@ -94,5 +93,3 @@ public:
GodotAreaSoftBodyPair3D(GodotSoftBody3D *p_sof_body, int p_soft_body_shape, GodotArea3D *p_area, int p_area_shape);
~GodotAreaSoftBodyPair3D();
};
#endif // GODOT_AREA_PAIR_3D_H

View file

@ -701,7 +701,7 @@ void GodotBody3D::integrate_velocities(real_t p_step) {
if (mode == PhysicsServer3D::BODY_MODE_KINEMATIC) {
_set_transform(new_transform, false);
_set_inv_transform(new_transform.affine_inverse());
if (contacts.size() == 0 && linear_velocity == Vector3() && angular_velocity == Vector3()) {
if (contacts.is_empty() && linear_velocity == Vector3() && angular_velocity == Vector3()) {
set_active(false); //stopped moving, deactivate
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_BODY_3D_H
#define GODOT_BODY_3D_H
#pragma once
#include "godot_area_3d.h"
#include "godot_collision_object_3d.h"
@ -176,6 +175,7 @@ public:
}
_FORCE_INLINE_ void set_max_contacts_reported(int p_size) {
ERR_FAIL_INDEX(p_size, MAX_CONTACTS_REPORTED_3D_MAX);
contacts.resize(p_size);
contact_count = 0;
if (mode == PhysicsServer3D::BODY_MODE_KINEMATIC && p_size) {
@ -392,5 +392,3 @@ void GodotBody3D::add_contact(const Vector3 &p_local_pos, const Vector3 &p_local
c[idx].collider_velocity_at_pos = p_collider_velocity_at_pos;
c[idx].impulse = p_impulse;
}
#endif // GODOT_BODY_3D_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_BODY_DIRECT_STATE_3D_H
#define GODOT_BODY_DIRECT_STATE_3D_H
#pragma once
#include "servers/physics_server_3d.h"
@ -103,5 +102,3 @@ public:
virtual real_t get_step() const override;
};
#endif // GODOT_BODY_DIRECT_STATE_3D_H

View file

@ -34,7 +34,7 @@
#include "godot_space_3d.h"
#define MIN_VELOCITY 0.0001
#define MAX_BIAS_ROTATION (Math_PI / 8)
#define MAX_BIAS_ROTATION (Math::PI / 8)
void GodotBodyPair3D::_contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, const Vector3 &normal, void *p_userdata) {
GodotBodyPair3D *pair = static_cast<GodotBodyPair3D *>(p_userdata);
@ -255,7 +255,7 @@ real_t combine_bounce(GodotBody3D *A, GodotBody3D *B) {
}
real_t combine_friction(GodotBody3D *A, GodotBody3D *B) {
return ABS(MIN(A->get_friction(), B->get_friction()));
return Math::abs(MIN(A->get_friction(), B->get_friction()));
}
bool GodotBodyPair3D::setup(real_t p_step) {

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_BODY_PAIR_3D_H
#define GODOT_BODY_PAIR_3D_H
#pragma once
#include "godot_body_3d.h"
#include "godot_constraint_3d.h"
@ -143,5 +142,3 @@ public:
GodotBodySoftBodyPair3D(GodotBody3D *p_A, int p_shape_A, GodotSoftBody3D *p_B);
~GodotBodySoftBodyPair3D();
};
#endif // GODOT_BODY_PAIR_3D_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_BROAD_PHASE_3D_H
#define GODOT_BROAD_PHASE_3D_H
#pragma once
#include "core/math/aabb.h"
#include "core/math/math_funcs.h"
@ -68,5 +67,3 @@ public:
virtual ~GodotBroadPhase3D();
};
#endif // GODOT_BROAD_PHASE_3D_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_BROAD_PHASE_3D_BVH_H
#define GODOT_BROAD_PHASE_3D_BVH_H
#pragma once
#include "godot_broad_phase_3d.h"
@ -96,5 +95,3 @@ public:
static GodotBroadPhase3D *_create();
GodotBroadPhase3DBVH();
};
#endif // GODOT_BROAD_PHASE_3D_BVH_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_COLLISION_OBJECT_3D_H
#define GODOT_COLLISION_OBJECT_3D_H
#pragma once
#include "godot_broad_phase_3d.h"
#include "godot_shape_3d.h"
@ -190,5 +189,3 @@ public:
virtual ~GodotCollisionObject3D() {}
};
#endif // GODOT_COLLISION_OBJECT_3D_H

View file

@ -61,8 +61,8 @@ bool GodotCollisionSolver3D::solve_static_world_boundary(const GodotShape3D *p_s
// Use 3 equidistant points on the circle.
for (int i = 0; i < 3; ++i) {
Vector3 vertex_pos = circle_pos;
vertex_pos += circle_axis_1 * Math::cos(2.0 * Math_PI * i / 3.0);
vertex_pos += circle_axis_2 * Math::sin(2.0 * Math_PI * i / 3.0);
vertex_pos += circle_axis_1 * Math::cos(2.0 * Math::PI * i / 3.0);
vertex_pos += circle_axis_2 * Math::sin(2.0 * Math::PI * i / 3.0);
supports[i] = vertex_pos;
}
}
@ -488,8 +488,8 @@ bool GodotCollisionSolver3D::solve_distance_world_boundary(const GodotShape3D *p
// Use 3 equidistant points on the circle.
for (int i = 0; i < 3; ++i) {
Vector3 vertex_pos = circle_pos;
vertex_pos += circle_axis_1 * Math::cos(2.0 * Math_PI * i / 3.0);
vertex_pos += circle_axis_2 * Math::sin(2.0 * Math_PI * i / 3.0);
vertex_pos += circle_axis_1 * Math::cos(2.0 * Math::PI * i / 3.0);
vertex_pos += circle_axis_2 * Math::sin(2.0 * Math::PI * i / 3.0);
supports[i] = vertex_pos;
}
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_COLLISION_SOLVER_3D_H
#define GODOT_COLLISION_SOLVER_3D_H
#pragma once
#include "godot_shape_3d.h"
@ -53,5 +52,3 @@ public:
static bool solve_static(const GodotShape3D *p_shape_A, const Transform3D &p_transform_A, const GodotShape3D *p_shape_B, const Transform3D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, Vector3 *r_sep_axis = nullptr, real_t p_margin_A = 0, real_t p_margin_B = 0);
static bool solve_distance(const GodotShape3D *p_shape_A, const Transform3D &p_transform_A, const GodotShape3D *p_shape_B, const Transform3D &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B, const AABB &p_concave_hint, Vector3 *r_sep_axis = nullptr);
};
#endif // GODOT_COLLISION_SOLVER_3D_H

View file

@ -104,7 +104,7 @@ static void _generate_contacts_point_edge(const Vector3 *p_points_A, int p_point
ERR_FAIL_COND(p_point_count_B != 2);
#endif
Vector3 closest_B = Geometry3D::get_closest_point_to_segment_uncapped(*p_points_A, p_points_B);
Vector3 closest_B = Geometry3D::get_closest_point_to_segment_uncapped(*p_points_A, p_points_B[0], p_points_B[1]);
p_callback->call(*p_points_A, closest_B, p_callback->normal);
}
@ -171,8 +171,8 @@ static void _generate_contacts_edge_edge(const Vector3 *p_points_A, int p_point_
d = 1.0;
}
Vector3 closest_A = p_points_A[0] + rel_A * d;
Vector3 closest_B = Geometry3D::get_closest_point_to_segment_uncapped(closest_A, p_points_B);
const Vector3 closest_A = p_points_A[0] + rel_A * d;
const Vector3 closest_B = Geometry3D::get_closest_point_to_segment_uncapped(closest_A, p_points_B[0], p_points_B[1]);
// The normal should be perpendicular to both edges.
Vector3 normal = rel_A.cross(rel_B);
real_t normal_len = normal.length();
@ -381,7 +381,7 @@ static void _generate_contacts_face_circle(const Vector3 *p_points_A, int p_poin
static const int circle_segments = 8;
Vector3 circle_points[circle_segments];
real_t angle_delta = 2.0 * Math_PI / circle_segments;
real_t angle_delta = 2.0 * Math::PI / circle_segments;
for (int i = 0; i < circle_segments; ++i) {
Vector3 point_pos = circle_B_pos;
@ -511,8 +511,8 @@ static void _generate_contacts_circle_circle(const Vector3 *p_points_A, int p_po
// Circle A inside circle B.
for (int i = 0; i < 3; ++i) {
Vector3 circle_A_point = circle_A_pos;
circle_A_point += circle_A_line_1 * Math::cos(2.0 * Math_PI * i / 3.0);
circle_A_point += circle_A_line_2 * Math::sin(2.0 * Math_PI * i / 3.0);
circle_A_point += circle_A_line_1 * Math::cos(2.0 * Math::PI * i / 3.0);
circle_A_point += circle_A_line_2 * Math::sin(2.0 * Math::PI * i / 3.0);
contact_points[num_points] = circle_A_point;
++num_points;
@ -521,8 +521,8 @@ static void _generate_contacts_circle_circle(const Vector3 *p_points_A, int p_po
// Circle B inside circle A.
for (int i = 0; i < 3; ++i) {
Vector3 circle_B_point = circle_B_pos;
circle_B_point += circle_B_line_1 * Math::cos(2.0 * Math_PI * i / 3.0);
circle_B_point += circle_B_line_2 * Math::sin(2.0 * Math_PI * i / 3.0);
circle_B_point += circle_B_line_1 * Math::cos(2.0 * Math::PI * i / 3.0);
circle_B_point += circle_B_line_2 * Math::sin(2.0 * Math::PI * i / 3.0);
Vector3 circle_A_point = circle_B_point - norm_proj;
@ -885,13 +885,12 @@ static void _collision_sphere_capsule(const GodotShape3D *p_a, const Transform3D
real_t scale_B = p_transform_b.basis[0].length();
// Construct the capsule segment (ball-center to ball-center)
Vector3 capsule_segment[2];
Vector3 capsule_axis = p_transform_b.basis.get_column(1) * (capsule_B->get_height() * 0.5 - capsule_B->get_radius());
capsule_segment[0] = p_transform_b.origin + capsule_axis;
capsule_segment[1] = p_transform_b.origin - capsule_axis;
const Vector3 capsule_segment_a = p_transform_b.origin + capsule_axis;
const Vector3 capsule_segment_b = p_transform_b.origin - capsule_axis;
// Get the capsules closest segment-point to the sphere
Vector3 capsule_closest = Geometry3D::get_closest_point_to_segment(p_transform_a.origin, capsule_segment);
Vector3 capsule_closest = Geometry3D::get_closest_point_to_segment(p_transform_a.origin, capsule_segment_a, capsule_segment_b);
// Perform an analytic sphere collision between the sphere and the sphere-collider in the capsule
analytic_sphere_collision<withMargin>(

View file

@ -28,11 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_COLLISION_SOLVER_3D_SAT_H
#define GODOT_COLLISION_SOLVER_3D_SAT_H
#pragma once
#include "godot_collision_solver_3d.h"
bool sat_calculate_penetration(const GodotShape3D *p_shape_A, const Transform3D &p_transform_A, const GodotShape3D *p_shape_B, const Transform3D &p_transform_B, GodotCollisionSolver3D::CallbackResult p_result_callback, void *p_userdata, bool p_swap = false, Vector3 *r_prev_axis = nullptr, real_t p_margin_a = 0, real_t p_margin_b = 0);
#endif // GODOT_COLLISION_SOLVER_3D_SAT_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_CONSTRAINT_3D_H
#define GODOT_CONSTRAINT_3D_H
#pragma once
class GodotBody3D;
class GodotSoftBody3D;
@ -77,5 +76,3 @@ public:
virtual ~GodotConstraint3D() {}
};
#endif // GODOT_CONSTRAINT_3D_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_JOINT_3D_H
#define GODOT_JOINT_3D_H
#pragma once
#include "godot_body_3d.h"
#include "godot_constraint_3d.h"
@ -40,7 +39,7 @@ protected:
bool dynamic_B = false;
void plane_space(const Vector3 &n, Vector3 &p, Vector3 &q) {
if (Math::abs(n.z) > Math_SQRT12) {
if (Math::abs(n.z) > Math::SQRT12) {
// choose p in y-z plane
real_t a = n[1] * n[1] + n[2] * n[2];
real_t k = 1.0 / Math::sqrt(a);
@ -58,7 +57,7 @@ protected:
}
_FORCE_INLINE_ real_t atan2fast(real_t y, real_t x) {
real_t coeff_1 = Math_PI / 4.0f;
real_t coeff_1 = Math::PI / 4.0f;
real_t coeff_2 = 3.0f * coeff_1;
real_t abs_y = Math::abs(y);
real_t angle;
@ -97,5 +96,3 @@ public:
}
}
};
#endif // GODOT_JOINT_3D_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_PHYSICS_SERVER_3D_H
#define GODOT_PHYSICS_SERVER_3D_H
#pragma once
#include "godot_joint_3d.h"
#include "godot_shape_3d.h"
@ -381,5 +380,3 @@ public:
GodotPhysicsServer3D(bool p_using_threads = false);
~GodotPhysicsServer3D() {}
};
#endif // GODOT_PHYSICS_SERVER_3D_H

View file

@ -216,12 +216,7 @@ bool GodotSeparationRayShape3D::intersect_point(const Vector3 &p_point) const {
}
Vector3 GodotSeparationRayShape3D::get_closest_point_to(const Vector3 &p_point) const {
Vector3 s[2] = {
Vector3(0, 0, 0),
Vector3(0, 0, length)
};
return Geometry3D::get_closest_point_to_segment(p_point, s);
return Geometry3D::get_closest_point_to_segment(p_point, Vector3(0, 0, 0), Vector3(0, 0, length));
}
Vector3 GodotSeparationRayShape3D::get_moment_of_inertia(real_t p_mass) const {
@ -455,19 +450,14 @@ Vector3 GodotBoxShape3D::get_closest_point_to(const Vector3 &p_point) const {
//check segments
real_t min_distance = 1e20;
Vector3 closest_vertex = half_extents * p_point.sign();
Vector3 s[2] = {
closest_vertex,
closest_vertex
};
const Vector3 closest_vertex = half_extents * p_point.sign();
for (int i = 0; i < 3; i++) {
s[1] = closest_vertex;
s[1][i] = -s[1][i]; //edge
Vector3 segment_b = closest_vertex;
segment_b[i] = -segment_b[i]; //edge
Vector3 closest_edge = Geometry3D::get_closest_point_to_segment(p_point, s);
const Vector3 closest_edge = Geometry3D::get_closest_point_to_segment(p_point, closest_vertex, segment_b);
real_t d = p_point.distance_to(closest_edge);
const real_t d = p_point.distance_to(closest_edge);
if (d < min_distance) {
min_point = closest_edge;
min_distance = d;
@ -618,12 +608,10 @@ bool GodotCapsuleShape3D::intersect_point(const Vector3 &p_point) const {
}
Vector3 GodotCapsuleShape3D::get_closest_point_to(const Vector3 &p_point) const {
Vector3 s[2] = {
Vector3(0, -height * 0.5 + radius, 0),
Vector3(0, height * 0.5 - radius, 0),
};
const Vector3 segment_a = Vector3(0, -height * 0.5 + radius, 0);
const Vector3 segment_b = Vector3(0, height * 0.5 - radius, 0);
Vector3 p = Geometry3D::get_closest_point_to_segment(p_point, s);
const Vector3 p = Geometry3D::get_closest_point_to_segment(p_point, segment_a, segment_b);
if (p.distance_to(p_point) < radius) {
return p_point;
@ -772,12 +760,10 @@ Vector3 GodotCylinderShape3D::get_closest_point_to(const Vector3 &p_point) const
return proj_point;
} else {
Vector3 s[2] = {
Vector3(0, -height * 0.5, 0),
Vector3(0, height * 0.5, 0),
};
const Vector3 segment_a = Vector3(0, -height * 0.5, 0);
const Vector3 segment_b = Vector3(0, height * 0.5, 0);
Vector3 p = Geometry3D::get_closest_point_to_segment(p_point, s);
const Vector3 p = Geometry3D::get_closest_point_to_segment(p_point, segment_a, segment_b);
if (p.distance_to(p_point) < radius) {
return p_point;
@ -852,7 +838,7 @@ void GodotConvexPolygonShape3D::project_range(const Vector3 &p_normal, const Tra
Vector3 GodotConvexPolygonShape3D::get_support(const Vector3 &p_normal) const {
// Skip if there are no vertices in the mesh
if (mesh.vertices.size() == 0) {
if (mesh.vertices.is_empty()) {
return Vector3();
}
@ -960,7 +946,7 @@ void GodotConvexPolygonShape3D::get_supports(const Vector3 &p_normal, int p_max,
for (int i = 0; i < ec; i++) {
real_t dot = (vertices[edges[i].vertex_a] - vertices[edges[i].vertex_b]).normalized().dot(p_normal);
dot = ABS(dot);
dot = Math::abs(dot);
if (dot < edge_support_threshold_lower && (edges[i].vertex_a == vtx || edges[i].vertex_b == vtx)) {
r_amount = 2;
r_type = FEATURE_EDGE;
@ -1068,12 +1054,10 @@ Vector3 GodotConvexPolygonShape3D::get_closest_point_to(const Vector3 &p_point)
const Geometry3D::MeshData::Edge *edges = mesh.edges.ptr();
int ec = mesh.edges.size();
for (int i = 0; i < ec; i++) {
Vector3 s[2] = {
vertices[edges[i].vertex_a],
vertices[edges[i].vertex_b]
};
const Vector3 segment_a = vertices[edges[i].vertex_a];
const Vector3 segment_b = vertices[edges[i].vertex_b];
Vector3 closest = Geometry3D::get_closest_point_to_segment(p_point, s);
Vector3 closest = Geometry3D::get_closest_point_to_segment(p_point, segment_a, segment_b);
real_t d = closest.distance_to(p_point);
if (d < min_distance) {
min_distance = d;
@ -1238,7 +1222,7 @@ void GodotFaceShape3D::get_supports(const Vector3 &p_normal, int p_max, Vector3
// check if edge is valid as a support
real_t dot = (vertex[i] - vertex[nx]).normalized().dot(n);
dot = ABS(dot);
dot = Math::abs(dot);
if (dot < edge_support_threshold_lower) {
r_amount = 2;
r_type = FEATURE_EDGE;
@ -1385,7 +1369,7 @@ void GodotConcavePolygonShape3D::_cull_segment(int p_idx, _SegmentCullParams *p_
}
bool GodotConcavePolygonShape3D::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal, int &r_face_index, bool p_hit_back_faces) const {
if (faces.size() == 0) {
if (faces.is_empty()) {
return false;
}
@ -1465,7 +1449,7 @@ bool GodotConcavePolygonShape3D::_cull(int p_idx, _CullParams *p_params) const {
void GodotConcavePolygonShape3D::cull(const AABB &p_local_aabb, QueryCallback p_callback, void *p_userdata, bool p_invert_backface_collision) const {
// make matrix local to concave
if (faces.size() == 0) {
if (faces.is_empty()) {
return;
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_SHAPE_3D_H
#define GODOT_SHAPE_3D_H
#pragma once
#include "core/math/geometry_3d.h"
#include "core/templates/local_vector.h"
@ -120,7 +119,7 @@ class GodotWorldBoundaryShape3D : public GodotShape3D {
public:
Plane get_plane() const;
virtual real_t get_volume() const override { return INFINITY; }
virtual real_t get_volume() const override { return Math::INF; }
virtual PhysicsServer3D::ShapeType get_type() const override { return PhysicsServer3D::SHAPE_WORLD_BOUNDARY; }
virtual void project_range(const Vector3 &p_normal, const Transform3D &p_transform, real_t &r_min, real_t &r_max) const override;
virtual Vector3 get_support(const Vector3 &p_normal) const override;
@ -173,7 +172,7 @@ class GodotSphereShape3D : public GodotShape3D {
public:
real_t get_radius() const;
virtual real_t get_volume() const override { return 4.0 / 3.0 * Math_PI * radius * radius * radius; }
virtual real_t get_volume() const override { return 4.0 / 3.0 * Math::PI * radius * radius * radius; }
virtual PhysicsServer3D::ShapeType get_type() const override { return PhysicsServer3D::SHAPE_SPHERE; }
@ -227,7 +226,7 @@ public:
_FORCE_INLINE_ real_t get_height() const { return height; }
_FORCE_INLINE_ real_t get_radius() const { return radius; }
virtual real_t get_volume() const override { return 4.0 / 3.0 * Math_PI * radius * radius * radius + (height - radius * 2.0) * Math_PI * radius * radius; }
virtual real_t get_volume() const override { return 4.0 / 3.0 * Math::PI * radius * radius * radius + (height - radius * 2.0) * Math::PI * radius * radius; }
virtual PhysicsServer3D::ShapeType get_type() const override { return PhysicsServer3D::SHAPE_CAPSULE; }
@ -256,7 +255,7 @@ public:
_FORCE_INLINE_ real_t get_height() const { return height; }
_FORCE_INLINE_ real_t get_radius() const { return radius; }
virtual real_t get_volume() const override { return height * Math_PI * radius * radius; }
virtual real_t get_volume() const override { return height * Math::PI * radius * radius; }
virtual PhysicsServer3D::ShapeType get_type() const override { return PhysicsServer3D::SHAPE_CYLINDER; }
@ -510,5 +509,3 @@ struct GodotMotionShape3D : public GodotShape3D {
GodotMotionShape3D() { configure(AABB()); }
};
#endif // GODOT_SHAPE_3D_H

View file

@ -1245,7 +1245,7 @@ struct _SoftBodyIntersectSegmentInfo {
Vector3 dir;
Vector3 hit_position;
uint32_t hit_face_index = -1;
real_t hit_dist_sq = INFINITY;
real_t hit_dist_sq = Math::INF;
static bool process_hit(uint32_t p_face_index, void *p_userdata) {
_SoftBodyIntersectSegmentInfo &query_info = *(static_cast<_SoftBodyIntersectSegmentInfo *>(p_userdata));
@ -1276,7 +1276,7 @@ bool GodotSoftBodyShape3D::intersect_segment(const Vector3 &p_begin, const Vecto
soft_body->query_ray(p_begin, p_end, _SoftBodyIntersectSegmentInfo::process_hit, &query_info);
if (query_info.hit_dist_sq != INFINITY) {
if (query_info.hit_dist_sq != Math::INF) {
r_result = query_info.hit_position;
r_normal = soft_body->get_face_normal(query_info.hit_face_index);
return true;

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_SOFT_BODY_3D_H
#define GODOT_SOFT_BODY_3D_H
#pragma once
#include "godot_area_3d.h"
#include "godot_collision_object_3d.h"
@ -272,5 +271,3 @@ public:
GodotSoftBodyShape3D(GodotSoftBody3D *p_soft_body);
~GodotSoftBodyShape3D() {}
};
#endif // GODOT_SOFT_BODY_3D_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_SPACE_3D_H
#define GODOT_SPACE_3D_H
#pragma once
#include "godot_area_3d.h"
#include "godot_body_3d.h"
@ -210,5 +209,3 @@ public:
GodotSpace3D();
~GodotSpace3D();
};
#endif // GODOT_SPACE_3D_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_STEP_3D_H
#define GODOT_STEP_3D_H
#pragma once
#include "godot_space_3d.h"
@ -57,5 +56,3 @@ public:
GodotStep3D();
~GodotStep3D();
};
#endif // GODOT_STEP_3D_H

View file

@ -112,7 +112,7 @@ bool GodotConeTwistJoint3D::setup(real_t p_timestep) {
}
Vector3 b1Axis1, b1Axis2, b1Axis3;
Vector3 b2Axis1, b2Axis2;
Vector3 b2Axis1;
b1Axis1 = A->get_transform().basis.xform(m_rbAFrame.basis.get_column(0));
b2Axis1 = B->get_transform().basis.xform(m_rbBFrame.basis.get_column(0));

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_CONE_TWIST_JOINT_3D_H
#define GODOT_CONE_TWIST_JOINT_3D_H
#pragma once
/*
Adapted to Godot from the Bullet library.
@ -80,7 +79,7 @@ public:
real_t m_biasFactor = 0.3;
real_t m_relaxationFactor = 1.0;
real_t m_swingSpan1 = Math_TAU / 8.0;
real_t m_swingSpan1 = Math::TAU / 8.0;
real_t m_swingSpan2 = 0.0;
real_t m_twistSpan = 0.0;
@ -138,5 +137,3 @@ public:
void set_param(PhysicsServer3D::ConeTwistJointParam p_param, real_t p_value);
real_t get_param(PhysicsServer3D::ConeTwistJointParam p_param) const;
};
#endif // GODOT_CONE_TWIST_JOINT_3D_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_GENERIC_6DOF_JOINT_3D_H
#define GODOT_GENERIC_6DOF_JOINT_3D_H
#pragma once
/*
Adapted to Godot from the Bullet library.
@ -318,5 +317,3 @@ public:
void set_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag, bool p_value);
bool get_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag) const;
};
#endif // GODOT_GENERIC_6DOF_JOINT_3D_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_HINGE_JOINT_3D_H
#define GODOT_HINGE_JOINT_3D_H
#pragma once
/*
Adapted to Godot from the Bullet library.
@ -76,8 +75,8 @@ class GodotHingeJoint3D : public GodotJoint3D {
real_t m_biasFactor = 0.3;
real_t m_relaxationFactor = 1.0;
real_t m_lowerLimit = Math_PI;
real_t m_upperLimit = -Math_PI;
real_t m_lowerLimit = Math::PI;
real_t m_upperLimit = -Math::PI;
real_t m_kHinge = 0.0;
@ -112,5 +111,3 @@ public:
GodotHingeJoint3D(GodotBody3D *rbA, GodotBody3D *rbB, const Transform3D &frameA, const Transform3D &frameB);
GodotHingeJoint3D(GodotBody3D *rbA, GodotBody3D *rbB, const Vector3 &pivotInA, const Vector3 &pivotInB, const Vector3 &axisInA, const Vector3 &axisInB);
};
#endif // GODOT_HINGE_JOINT_3D_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_JACOBIAN_ENTRY_3D_H
#define GODOT_JACOBIAN_ENTRY_3D_H
#pragma once
/*
Adapted to Godot from the Bullet library.
@ -165,5 +164,3 @@ public:
//Optimization: can be stored in the w/last component of one of the vectors
real_t m_Adiag = 1.0;
};
#endif // GODOT_JACOBIAN_ENTRY_3D_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_PIN_JOINT_3D_H
#define GODOT_PIN_JOINT_3D_H
#pragma once
/*
Adapted to Godot from the Bullet library.
@ -91,5 +90,3 @@ public:
GodotPinJoint3D(GodotBody3D *p_body_a, const Vector3 &p_pos_a, GodotBody3D *p_body_b, const Vector3 &p_pos_b);
~GodotPinJoint3D();
};
#endif // GODOT_PIN_JOINT_3D_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_SLIDER_JOINT_3D_H
#define GODOT_SLIDER_JOINT_3D_H
#pragma once
/*
Adapted to Godot from the Bullet library.
@ -242,5 +241,3 @@ public:
virtual PhysicsServer3D::JointType get_type() const override { return PhysicsServer3D::JOINT_TYPE_SLIDER; }
};
#endif // GODOT_SLIDER_JOINT_3D_H

View file

@ -28,12 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GODOT_PHYSICS_3D_REGISTER_TYPES_H
#define GODOT_PHYSICS_3D_REGISTER_TYPES_H
#pragma once
#include "modules/register_module_types.h"
void initialize_godot_physics_3d_module(ModuleInitializationLevel p_level);
void uninitialize_godot_physics_3d_module(ModuleInitializationLevel p_level);
#endif // GODOT_PHYSICS_3D_REGISTER_TYPES_H