1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
use crate::{
    prelude::*,
    sync::{ancestor_marker::AncestorMarker, PreviousGlobalTransform, SyncConfig},
};
use bevy::prelude::*;
use broad_phase::AabbIntersections;
use dynamics::solver::SolverConfig;

/// Registers physics types to the `TypeRegistry` resource in `bevy_reflect`.
pub struct PhysicsTypeRegistrationPlugin;

impl Plugin for PhysicsTypeRegistrationPlugin {
    fn build(&self, app: &mut App) {
        app.register_type::<Time<Physics>>()
            .register_type::<Time<Substeps>>()
            .register_type::<SubstepCount>()
            .register_type::<BroadCollisionPairs>()
            .register_type::<AabbIntersections>()
            .register_type::<SleepingThreshold>()
            .register_type::<DeactivationTime>()
            .register_type::<Gravity>()
            .register_type::<RigidBody>()
            .register_type::<Sleeping>()
            .register_type::<SleepingDisabled>()
            .register_type::<TimeSleeping>()
            .register_type::<Position>()
            .register_type::<Rotation>()
            .register_type::<PreSolveAccumulatedTranslation>()
            .register_type::<PreviousRotation>()
            .register_type::<PreviousGlobalTransform>()
            .register_type::<AccumulatedTranslation>()
            .register_type::<LinearVelocity>()
            .register_type::<AngularVelocity>()
            .register_type::<PreSolveLinearVelocity>()
            .register_type::<PreSolveAngularVelocity>()
            .register_type::<Restitution>()
            .register_type::<Friction>()
            .register_type::<LinearDamping>()
            .register_type::<AngularDamping>()
            .register_type::<ExternalForce>()
            .register_type::<ExternalTorque>()
            .register_type::<ExternalImpulse>()
            .register_type::<ExternalAngularImpulse>()
            .register_type::<GravityScale>()
            .register_type::<Mass>()
            .register_type::<InverseMass>()
            .register_type::<Inertia>()
            .register_type::<InverseInertia>()
            .register_type::<CenterOfMass>()
            .register_type::<ColliderDensity>()
            .register_type::<ColliderMassProperties>()
            .register_type::<LockedAxes>()
            .register_type::<ColliderParent>()
            .register_type::<Dominance>()
            .register_type::<ColliderAabb>()
            .register_type::<CollisionLayers>()
            .register_type::<CollidingEntities>()
            .register_type::<CoefficientCombine>()
            .register_type::<Sensor>()
            .register_type::<ColliderTransform>()
            .register_type::<PreviousColliderTransform>()
            .register_type::<SpeculativeMargin>()
            .register_type::<SweptCcd>()
            .register_type::<CollisionMargin>()
            .register_type::<NarrowPhaseConfig>()
            .register_type::<SolverConfig>()
            .register_type::<SyncConfig>()
            .register_type::<AncestorMarker<RigidBody>>()
            .register_type::<AncestorMarker<ColliderMarker>>()
            .register_type::<RayCaster>()
            .register_type::<DistanceJoint>()
            .register_type::<FixedJoint>()
            .register_type::<PrismaticJoint>()
            .register_type::<RevoluteJoint>();

        #[cfg(feature = "default-collider")]
        app.register_type::<ColliderConstructor>()
            .register_type::<ColliderConstructorHierarchy>()
            .register_type::<ColliderConstructorHierarchyConfig>()
            .register_type::<ShapeCaster>();

        #[cfg(feature = "3d")]
        app.register_type::<SphericalJoint>();
    }
}