summaryrefslogtreecommitdiff
path: root/modules/bullet/shape_bullet.h
diff options
context:
space:
mode:
Diffstat (limited to 'modules/bullet/shape_bullet.h')
-rw-r--r--modules/bullet/shape_bullet.h45
1 files changed, 18 insertions, 27 deletions
diff --git a/modules/bullet/shape_bullet.h b/modules/bullet/shape_bullet.h
index 0dbc616fe5..0822399b5e 100644
--- a/modules/bullet/shape_bullet.h
+++ b/modules/bullet/shape_bullet.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -31,8 +31,8 @@
#ifndef SHAPE_BULLET_H
#define SHAPE_BULLET_H
-#include "core/math/geometry.h"
-#include "core/variant.h"
+#include "core/math/geometry_3d.h"
+#include "core/variant/variant.h"
#include "rid_bullet.h"
#include "servers/physics_server_3d.h"
@@ -50,9 +50,8 @@ class ShapeOwnerBullet;
class btBvhTriangleMeshShape;
class ShapeBullet : public RIDBullet {
-
Map<ShapeOwnerBullet *, int> owners;
- real_t margin;
+ real_t margin = 0.04;
protected:
/// return self
@@ -82,7 +81,7 @@ public:
public:
static class btEmptyShape *create_shape_empty();
- static class btStaticPlaneShape *create_shape_plane(const btVector3 &planeNormal, btScalar planeConstant);
+ static class btStaticPlaneShape *create_shape_world_boundary(const btVector3 &planeNormal, btScalar planeConstant);
static class btSphereShape *create_shape_sphere(btScalar radius);
static class btBoxShape *create_shape_box(const btVector3 &boxHalfExtents);
static class btCapsuleShape *create_shape_capsule(btScalar radius, btScalar height);
@@ -90,16 +89,15 @@ public:
/// IMPORTANT: Remember to delete the shape interface by calling: delete my_shape->getMeshInterface();
static class btConvexPointCloudShape *create_shape_convex(btAlignedObjectArray<btVector3> &p_vertices, const btVector3 &p_local_scaling = btVector3(1, 1, 1));
static class btScaledBvhTriangleMeshShape *create_shape_concave(btBvhTriangleMeshShape *p_mesh_shape, const btVector3 &p_local_scaling = btVector3(1, 1, 1));
- static class btHeightfieldTerrainShape *create_shape_height_field(Vector<real_t> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height);
+ static class btHeightfieldTerrainShape *create_shape_height_field(Vector<float> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height);
static class btRayShape *create_shape_ray(real_t p_length, bool p_slips_on_slope);
};
-class PlaneShapeBullet : public ShapeBullet {
-
+class WorldBoundaryShapeBullet : public ShapeBullet {
Plane plane;
public:
- PlaneShapeBullet();
+ WorldBoundaryShapeBullet();
virtual void set_data(const Variant &p_data);
virtual Variant get_data() const;
@@ -111,7 +109,6 @@ private:
};
class SphereShapeBullet : public ShapeBullet {
-
real_t radius;
public:
@@ -128,7 +125,6 @@ private:
};
class BoxShapeBullet : public ShapeBullet {
-
btVector3 half_extents;
public:
@@ -145,7 +141,6 @@ private:
};
class CapsuleShapeBullet : public ShapeBullet {
-
real_t height;
real_t radius;
@@ -164,7 +159,6 @@ private:
};
class CylinderShapeBullet : public ShapeBullet {
-
real_t height;
real_t radius;
@@ -183,7 +177,6 @@ private:
};
class ConvexPolygonShapeBullet : public ShapeBullet {
-
public:
btAlignedObjectArray<btVector3> vertices;
@@ -200,7 +193,7 @@ private:
};
class ConcavePolygonShapeBullet : public ShapeBullet {
- class btBvhTriangleMeshShape *meshShape;
+ class btBvhTriangleMeshShape *meshShape = nullptr;
public:
Vector<Vector3> faces;
@@ -218,13 +211,12 @@ private:
};
class HeightMapShapeBullet : public ShapeBullet {
-
public:
- Vector<real_t> heights;
- int width;
- int depth;
- real_t min_height;
- real_t max_height;
+ Vector<float> heights;
+ int width = 0;
+ int depth = 0;
+ real_t min_height = 0.0;
+ real_t max_height = 0.0;
HeightMapShapeBullet();
@@ -234,14 +226,13 @@ public:
virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0);
private:
- void setup(Vector<real_t> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height);
+ void setup(Vector<float> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height);
};
class RayShapeBullet : public ShapeBullet {
-
public:
- real_t length;
- bool slips_on_slope;
+ real_t length = 1.0;
+ bool slips_on_slope = false;
RayShapeBullet();