载入中...
搜索中...
未找到
ForceModels.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4#include <limits>
5#include "common/Result.h"
6
7namespace eve::physics {
8class Body;
9class Body3D;
10
13 double x = 0, y = 0, z = 0;
14};
15
18
30
36
42
46 double strength = 1;
47 double softening = 0.1;
48 double maxAcceleration = std::numeric_limits<double>::max();
49 double maxForce =
50 std::numeric_limits<double>::max();
51};
52
55 ForceVector gravity{0, -9.81, 0};
56 double fluidDensity = 1000;
57 double displacedVolume = 0;
58};
59
62 double linear = 0;
63 double quadratic = 0;
64};
65
71 double linear = 0, quadratic = 0;
72};
73
75struct WingModel {
76 ForceVector chord{1, 0, 0};
78 double density = 1.225;
79 double area = 1;
80 double liftSlope = 6.283185307179586;
81 double zeroLiftAngle = 0;
82 double stallAngle = 0.2617993877991494;
83 double baseDrag = 0.02;
84 double aspectRatio = 6;
85 double efficiency = 0.8;
86};
87
93
96 double staticCoefficient = 0.9;
97 double kineticCoefficient = 0.7;
98};
99
101struct TireModel {
102 double radius = 0.3, inertia = 1;
104 double rollingResistance = 0.015;
105 double minimumSlipSpeed = 0.5;
106};
107
116
120 double slipRatio = 0, slipAngle = 0;
123 0;
124};
125
137public:
139 [[nodiscard]] static Result<ForceVector> directional(const DirectionalField& model, ForceVector position,
140 double mass);
142 [[nodiscard]] static Result<ForceVector> directionalForce(const DirectionalForceField& model, ForceVector position);
144 [[nodiscard]] static Result<ForceVector> radial(const RadialField& model, ForceVector position, double mass);
146 [[nodiscard]] static Result<ForceVector> buoyancy(const BuoyancyModel& model);
148 [[nodiscard]] static Result<ForceVector> damping(const DampingModel& model, ForceVector relativeVelocity,
149 double mass, double dt);
153 [[nodiscard]] static Result<double> angularDamping2D(const AngularDampingModel& model,
154 double relativeAngularVelocity, double inertia, double dt);
159 [[nodiscard]] static Result<ForceVector> angularDamping3D(const AngularDampingModel& model,
160 ForceVector relativeAngularVelocity,
161 ForceVector principalInertia, double dt);
163 [[nodiscard]] static Result<WingSample> wing(const WingModel& model, ForceVector relativeVelocity);
165 [[nodiscard]] static Result<ForceVector> friction(const FrictionModel& model, ForceVector tangentVelocity,
166 ForceVector demandedForce, double normalLoad);
173 [[nodiscard]] static Result<TireSample> tire(const TireModel& model, const TireInput& input, double dt);
174};
175
190} // namespace eve::physics
EvpackChunkInput input
Definition Evpack.cpp:170
#define EVENGINE_API_WORLD
Definition Export.h:109
ForceVector force
float inertia
float normalLoad
float friction
std::array< float, 3 > position
double dt
std::string body
glm::mat4 model
Move-only, checked operation results for the common layer.
glm::vec3 point
Move-only operation result carrying either a value or Status.
Definition Result.h:176
Backend-neutral 3D rigid body in meter-space coordinates (+Y up by convention). Owned by a World3D; c...
Definition Body3D.h:31
2D rigid body (Box2D) in pixel-space coordinates. Owned by a World; create shapes with newRectangleFi...
Definition Body.h:21
Pure force evaluators for 2D XY slices and full 3D, returning owning SI values. @ownership Inputs are...
Optional physics backend for vehicle mobility and body attach.
Definition Climbing.h:36
Result< void > applyForceSI(Body &body, ForceVector force, ForceVector point)
Apply an SI force to a 2D body at an SI world point, converting through its world meter....
FieldRegionKind
Spatial support; RectangleXY ignores Z, Box is axis-aligned in world space.
Definition ForceModels.h:17
Isotropic angular drag against body-minus-medium angular velocity.
Definition ForceModels.h:70
Displaced-volume buoyancy; caller supplies submerged volume and centroid.
Definition ForceModels.h:54
double displacedVolume
m^3 actually submerged, not total hull volume.
Definition ForceModels.h:57
double fluidDensity
kg/m^3; a 2D slice must supply physical thickness.
Definition ForceModels.h:56
Isotropic linear and quadratic drag against velocity relative to a medium.
Definition ForceModels.h:61
double quadratic
kg/m; aerodynamic value is rho * Cd * area / 2.
Definition ForceModels.h:63
Directional acceleration in m/s^2, independent of body mass.
Definition ForceModels.h:32
Directional force in N, independent of the affected body's mass.
Definition ForceModels.h:38
SI field support; Sphere with negative radius retains the unbounded convention.
Definition ForceModels.h:23
double edgeWidth
Linear interior fade in meters; cannot exceed the smallest support half size.
Definition ForceModels.h:26
Owning world-space SI vector; 2D uses XY with Z exactly zero.
Definition ForceModels.h:12
Coulomb static/kinetic friction coefficients (static >= kinetic >= 0).
Definition ForceModels.h:95
Softened inverse-square field; positive strength attracts, negative repels.
Definition ForceModels.h:44
double softening
Strictly positive core radius in meters.
Definition ForceModels.h:47
double maxForce
Finite nonnegative N cap, applied together with acceleration cap.
Definition ForceModels.h:49
double strength
Gravitational parameter in m^3/s^2, not a relativistic black hole.
Definition ForceModels.h:46
double maxAcceleration
Finite nonnegative m/s^2 cap after region fade.
Definition ForceModels.h:48
Contact-frame sample: +X forward, +Y lateral; ground-relative m/s, N, Nm.
double angularVelocity
rad/s; positive rolls toward +X.
double lateralInverseMass
Effective contact inverse masses, 1/kg; zero prescribes chassis velocity.
Caller-owned wheel parameters; stiffness in N per unit slip / radian.
double minimumSlipSpeed
Positive low-speed regularization, m/s.
Owning wheel step result; publish angularVelocity once after a successful step.
double resistanceTorque
Actual signed brake plus rolling-resistance torque, bounded by the requested capacity.
Wing geometry and game-oriented continuous stall polar, all in SI/radians.
Definition ForceModels.h:75
ForceVector chord
Unit forward direction in world space.
Definition ForceModels.h:76
ForceVector normal
Unit upper surface normal, perpendicular to chord.
Definition ForceModels.h:77
double liftSlope
Cl per radian before stall.
Definition ForceModels.h:80
Owning force and observable coefficients from a wing sample.
Definition ForceModels.h:89