Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergej Reich <sergej.reich@googlemail.com>2013-01-23 09:56:56 +0400
committerSergej Reich <sergej.reich@googlemail.com>2013-01-23 09:56:56 +0400
commit47c96081d00f2edfb1148d5d7c276489f03a8581 (patch)
tree51f1b93916d4042313dad5bc3907dcc6e0b33503 /source/blender/makesdna/DNA_rigidbody_types.h
parentcdc8ed24bfc771e8fcf729ce23db9ab060ade87d (diff)
rigidbody: Add rigid body constraints
Constraints connect two rigid bodies. Depending on which constraint is used different degrees of freedom are limited, e.g. a hinge constraint only allows the objects to rotate around a common axis. Constraints are implemented as individual objects and bahave similar to rigid bodies in terms of adding/removing/validating. The position and orientation of the constraint object is the pivot point of the constraint. Constraints have their own group in the rigid body world. To make connecting rigid bodies easier, there is a "Connect" operator that creates an empty objects with a rigid body constraint connecting the selected objects to active. Currently the following constraints are implemented: * Fixed * Point * Hinge * Slider * Piston * Generic Note: constraint limits aren't animatable yet).
Diffstat (limited to 'source/blender/makesdna/DNA_rigidbody_types.h')
-rw-r--r--source/blender/makesdna/DNA_rigidbody_types.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_rigidbody_types.h b/source/blender/makesdna/DNA_rigidbody_types.h
index e08162fedd6..5b7ffe4209c 100644
--- a/source/blender/makesdna/DNA_rigidbody_types.h
+++ b/source/blender/makesdna/DNA_rigidbody_types.h
@@ -53,6 +53,8 @@ typedef struct RigidBodyWorld {
struct Group *group; /* Group containing objects to use for Rigid Bodies */
struct Object **objects; /* Array to access group objects by index, only used at runtime */
+ struct Group *constraints; /* Group containing objects to use for Rigid Body Constraints*/
+
int pad;
float ltime; /* last frame world was evaluated for (internal) */
@@ -172,6 +174,92 @@ typedef enum eRigidBody_Shape {
} eRigidBody_Shape;
/* ******************************** */
+/* RigidBody Constraint */
+
+/* RigidBodyConstraint (rbc)
+ *
+ * Represents an constraint connecting two rigid bodies.
+ */
+typedef struct RigidBodyCon {
+ struct Object *ob1; /* First object influenced by the constraint */
+ struct Object *ob2; /* Second object influenced by the constraint */
+
+ /* General Settings for this RigidBodyCon */
+ short type; /* (eRigidBodyCon_Type) role of RigidBody in sim */
+ short num_solver_iterations;/* number of constraint solver iterations made per simulation step */
+
+ int flag; /* (eRigidBodyCon_Flag) */
+
+ float breaking_threshold; /* breaking impulse threshold */
+ float pad;
+
+ /* limits */
+ float limit_lin_x_lower; /* lower limit for x axis translation */
+ float limit_lin_x_upper; /* upper limit for x axis translation */
+ float limit_lin_y_lower; /* lower limit for y axis translation */
+ float limit_lin_y_upper; /* upper limit for y axis translation */
+ float limit_lin_z_lower; /* lower limit for z axis translation */
+ float limit_lin_z_upper; /* upper limit for z axis translation */
+ float limit_ang_x_lower; /* lower limit for x axis rotation */
+ float limit_ang_x_upper; /* upper limit for x axis rotation */
+ float limit_ang_y_lower; /* lower limit for y axis rotation */
+ float limit_ang_y_upper; /* upper limit for y axis rotation */
+ float limit_ang_z_lower; /* lower limit for z axis rotation */
+ float limit_ang_z_upper; /* upper limit for z axis rotation */
+
+ /* References to Physics Sim object. Exist at runtime only */
+ void *physics_constraint; /* Physics object representation (i.e. btTypedConstraint) */
+} RigidBodyCon;
+
+
+/* Participation types for RigidBodyOb */
+typedef enum eRigidBodyCon_Type {
+ /* lets bodies rotate around a specified point */
+ RBC_TYPE_POINT = 0,
+ /* lets bodies rotate around a specified axis */
+ RBC_TYPE_HINGE,
+ /* simulates wheel suspension */
+ RBC_TYPE_HINGE2,
+ /* restricts movent to a specified axis */
+ RBC_TYPE_SLIDER,
+ /* lets object rotate within a cpecified cone */
+ RBC_TYPE_CONE_TWIST,
+ /* allows user to specify constraint axes */
+ RBC_TYPE_6DOF,
+ /* like 6DOF but has springs */
+ RBC_TYPE_6DOF_SPRING,
+ /* simulates a universal joint */
+ RBC_TYPE_UNIVERSAL,
+ /* glues two bodies together */
+ RBC_TYPE_FIXED,
+ /* similar to slider but also allows rotation around slider axis */
+ RBC_TYPE_PISTON,
+ /* Simplified spring constraint with only once axis that's automatically placed between the connected bodies */
+ RBC_TYPE_SPRING
+} eRigidBodyCon_Type;
+
+/* Flags for RigidBodyCon */
+typedef enum eRigidBodyCon_Flag {
+ /* constraint influences rigid body motion */
+ RBC_FLAG_ENABLED = (1<<0),
+ /* constraint needs to be validated */
+ RBC_FLAG_NEEDS_VALIDATE = (1<<1),
+ /* allow constrained bodies to collide */
+ RBC_FLAG_DISABLE_COLLISIONS = (1<<2),
+ /* constraint can break */
+ RBC_FLAG_USE_BREAKING = (1<<3),
+ /* constraint use custom number of constraint solver iterations */
+ RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS = (1<<4),
+ /* limits */
+ RBC_FLAG_USE_LIMIT_LIN_X = (1<<5),
+ RBC_FLAG_USE_LIMIT_LIN_Y = (1<<6),
+ RBC_FLAG_USE_LIMIT_LIN_Z = (1<<7),
+ RBC_FLAG_USE_LIMIT_ANG_X = (1<<8),
+ RBC_FLAG_USE_LIMIT_ANG_Y = (1<<9),
+ RBC_FLAG_USE_LIMIT_ANG_Z = (1<<10),
+} eRigidBodyCon_Flag;
+
+/* ******************************** */
#endif /* __DNA_RIGIDBODY_TYPES_H__ */