Blender  V3.3
DNA_rigidbody_types.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2013 Blender Foundation. All rights reserved. */
3 
9 #pragma once
10 
11 #include "DNA_listBase.h"
12 #include "DNA_object_force_types.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 struct Collection;
19 
20 struct EffectorWeights;
21 
22 /* ******************************** */
23 /* RigidBody World */
24 
26 typedef struct RigidBodyWorld_Shared {
27  /* cache */
29  struct ListBase ptcaches;
30 
31  /* References to Physics Sim objects. Exist at runtime only ---------------------- */
35 
36 /* RigidBodyWorld (rbw)
37  *
38  * Represents a "simulation scene" existing within the parent scene.
39  */
40 typedef struct RigidBodyWorld {
41  /* Sim World Settings ------------------------------------------------------------- */
44 
46  struct Collection *group;
48  struct Object **objects;
49 
52 
53  char _pad[4];
55  float ltime;
56 
60  struct PointCache *pointcache DNA_DEPRECATED;
62  struct ListBase ptcaches DNA_DEPRECATED;
64  int numbodies;
65 
70 
72  int flag;
74  float time_scale;
76 
78 typedef enum eRigidBodyWorld_Flag {
79  /* should sim world be skipped when evaluating (user setting) */
80  RBW_FLAG_MUTED = (1 << 0),
81  /* sim data needs to be rebuilt */
82  /* RBW_FLAG_NEEDS_REBUILD = (1 << 1), */ /* UNUSED */
86 
87 /* ******************************** */
88 /* RigidBody Object */
89 
90 /* Container for data that is shared among CoW copies.
91  *
92  * This is placed in a separate struct so that, for example, the physics_shape
93  * pointer can be replaced without having to update all CoW copies. */
94 #
95 #
96 typedef struct RigidBodyOb_Shared {
97  /* References to Physics Sim objects. Exist at runtime only */
103 
104 /* RigidBodyObject (rbo)
105  *
106  * Represents an object participating in a RigidBody sim.
107  * This is attached to each object that is currently
108  * participating in a sim.
109  */
110 typedef struct RigidBodyOb {
111  /* General Settings for this RigidBodyOb */
113  short type;
115  short shape;
116 
118  int flag;
122  short mesh_source;
123  char _pad[2];
124 
125  /* Physics Parameters */
127  float mass;
128 
130  float friction;
132  float restitution;
133 
135  float margin;
136 
138  float lin_damping;
140  float ang_damping;
141 
146 
148  float orn[4];
150  float pos[3];
151  char _pad1[4];
152 
156 
158 typedef enum eRigidBodyOb_Type {
159  /* active geometry participant in simulation. is directly controlled by sim */
161  /* passive geometry participant in simulation. is directly controlled by animsys */
164 
166 typedef enum eRigidBodyOb_Flag {
167  /* rigidbody is kinematic (controlled by the animation system) */
168  RBO_FLAG_KINEMATIC = (1 << 0),
169  /* rigidbody needs to be validated (usually set after duplicating and not hooked up yet) */
171  /* rigidbody shape needs refreshing (usually after exiting editmode) */
173  /* rigidbody can be deactivated */
175  /* rigidbody is deactivated at the beginning of simulation */
177  /* rigidbody is not dynamically simulated */
178  RBO_FLAG_DISABLED = (1 << 5),
179  /* collision margin is not embedded (only used by convex hull shapes for now) */
181  /* collision shape deforms during simulation (only for passive triangle mesh shapes) */
184 
186 typedef enum eRigidBody_Shape {
197 
202 
203  /* concave mesh approximated using primitives */
206 
207 typedef enum eRigidBody_MeshSource {
208  /* base mesh */
210  /* only deformations */
212  /* final derived mesh */
215 
216 /* ******************************** */
217 /* RigidBody Constraint */
218 
219 /* RigidBodyConstraint (rbc)
220  *
221  * Represents an constraint connecting two rigid bodies.
222  */
223 typedef struct RigidBodyCon {
225  struct Object *ob1;
227  struct Object *ob2;
228 
229  /* General Settings for this RigidBodyCon */
231  short type;
234 
236  int flag;
237 
242  char _pad[3];
243 
244  /* limits */
245  /* translation limits */
252  /* rotation limits */
259 
260  /* spring settings */
261  /* resistance to deformation */
268  /* amount of velocity lost over time */
275 
276  /* motor settings */
285 
286  /* References to Physics Sim object. Exist at runtime only */
290 
292 typedef enum eRigidBodyCon_Type {
298  /* RBC_TYPE_HINGE2 = 2, */ /* UNUSED */
302  /* RBC_TYPE_CONE_TWIST = 4, */ /* UNUSED */
308  /* RBC_TYPE_UNIVERSAL = 7, */ /* UNUSED */
315  /* RBC_TYPE_SPRING = 10, */ /* UNUSED */
319 
322  RBC_SPRING_TYPE1 = 0, /* btGeneric6DofSpringConstraint */
323  RBC_SPRING_TYPE2 = 1, /* btGeneric6DofSpring2Constraint */
325 
327 typedef enum eRigidBodyCon_Flag {
328  /* constraint influences rigid body motion */
329  RBC_FLAG_ENABLED = (1 << 0),
330  /* constraint needs to be validated */
332  /* allow constrained bodies to collide */
334  /* constraint can break */
336  /* constraint use custom number of constraint solver iterations */
338  /* limits */
345  /* springs */
349  /* motors */
352  /* angular springs */
357 
358 /* ******************************** */
359 
360 #ifdef __cplusplus
361 }
362 #endif
These structs are the foundation for all linked lists in the library system.
eRigidBodyOb_Type
@ RBO_TYPE_ACTIVE
@ RBO_TYPE_PASSIVE
eRigidBodyWorld_Flag
@ RBW_FLAG_MUTED
@ RBW_FLAG_USE_SPLIT_IMPULSE
struct RigidBodyOb_Shared RigidBodyOb_Shared
eRigidBody_MeshSource
@ RBO_MESH_DEFORM
@ RBO_MESH_FINAL
@ RBO_MESH_BASE
struct RigidBodyOb RigidBodyOb
eRigidBodyCon_Type
@ RBC_TYPE_POINT
@ RBC_TYPE_HINGE
@ RBC_TYPE_FIXED
@ RBC_TYPE_SLIDER
@ RBC_TYPE_MOTOR
@ RBC_TYPE_6DOF_SPRING
@ RBC_TYPE_PISTON
@ RBC_TYPE_6DOF
eRigidBodyOb_Flag
@ RBO_FLAG_USE_MARGIN
@ RBO_FLAG_START_DEACTIVATED
@ RBO_FLAG_KINEMATIC
@ RBO_FLAG_USE_DEFORM
@ RBO_FLAG_NEEDS_VALIDATE
@ RBO_FLAG_USE_DEACTIVATION
@ RBO_FLAG_NEEDS_RESHAPE
@ RBO_FLAG_DISABLED
eRigidBodyCon_Flag
@ RBC_FLAG_NEEDS_VALIDATE
@ RBC_FLAG_USE_MOTOR_ANG
@ RBC_FLAG_USE_SPRING_Y
@ RBC_FLAG_USE_SPRING_ANG_Y
@ RBC_FLAG_USE_SPRING_ANG_X
@ RBC_FLAG_USE_LIMIT_ANG_X
@ RBC_FLAG_USE_LIMIT_LIN_Y
@ RBC_FLAG_USE_LIMIT_ANG_Y
@ RBC_FLAG_USE_MOTOR_LIN
@ RBC_FLAG_DISABLE_COLLISIONS
@ RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS
@ RBC_FLAG_USE_BREAKING
@ RBC_FLAG_ENABLED
@ RBC_FLAG_USE_SPRING_Z
@ RBC_FLAG_USE_LIMIT_LIN_X
@ RBC_FLAG_USE_SPRING_ANG_Z
@ RBC_FLAG_USE_SPRING_X
@ RBC_FLAG_USE_LIMIT_LIN_Z
@ RBC_FLAG_USE_LIMIT_ANG_Z
eRigidBody_Shape
@ RB_SHAPE_CAPSULE
@ RB_SHAPE_CONVEXH
@ RB_SHAPE_COMPOUND
@ RB_SHAPE_BOX
@ RB_SHAPE_TRIMESH
@ RB_SHAPE_SPHERE
@ RB_SHAPE_CYLINDER
@ RB_SHAPE_CONE
struct RigidBodyWorld RigidBodyWorld
eRigidBodyCon_SpringType
@ RBC_SPRING_TYPE1
@ RBC_SPRING_TYPE2
struct RigidBodyCon RigidBodyCon
struct RigidBodyWorld_Shared RigidBodyWorld_Shared
struct Object * ob1
float motor_lin_target_velocity
float motor_ang_target_velocity
struct Object * ob2
struct RigidBodyOb_Shared * shared
struct PointCache * pointcache
struct Collection * constraints
struct Collection * group
struct PointCache *pointcache DNA_DEPRECATED
struct RigidBodyWorld_Shared * shared
struct Object ** objects
struct EffectorWeights * effector_weights