Skip to content

Commit af6991e

Browse files
committed
Added a little documentation to the DemoPoseIntegratorCallbacks.
1 parent 5837609 commit af6991e

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

Demos/DemoCallbacks.cs

+17-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,19 @@ namespace Demos
1212
{
1313
public struct DemoPoseIntegratorCallbacks : IPoseIntegratorCallbacks
1414
{
15+
/// <summary>
16+
/// Gravity to apply to dynamic bodies in the simulation.
17+
/// </summary>
1518
public Vector3 Gravity;
19+
/// <summary>
20+
/// Fraction of dynamic body linear velocity to remove per unit of time. Values range from 0 to 1. 0 is fully undamped, while values very close to 1 will remove most velocity.
21+
/// </summary>
1622
public float LinearDamping;
23+
/// <summary>
24+
/// Fraction of dynamic body angular velocity to remove per unit of time. Values range from 0 to 1. 0 is fully undamped, while values very close to 1 will remove most velocity.
25+
/// </summary>
1726
public float AngularDamping;
27+
1828
Vector3 gravityDt;
1929
float linearDampingDt;
2030
float angularDampingDt;
@@ -27,7 +37,12 @@ public void Initialize(Simulation simulation)
2737
//If you had a simulation with per body gravity stored in a CollidableProperty<T> or something similar, having the simulation provided in a callback can be helpful.
2838
}
2939

30-
40+
/// <summary>
41+
/// Creates a new set of simple callbacks for the demos.
42+
/// </summary>
43+
/// <param name="gravity">Gravity to apply to dynamic bodies in the simulation.</param>
44+
/// <param name="linearDamping">Fraction of dynamic body linear velocity to remove per unit of time. Values range from 0 to 1. 0 is fully undamped, while values very close to 1 will remove most velocity.</param>
45+
/// <param name="angularDamping">Fraction of dynamic body angular velocity to remove per unit of time. Values range from 0 to 1. 0 is fully undamped, while values very close to 1 will remove most velocity.</param>
3146
public DemoPoseIntegratorCallbacks(Vector3 gravity, float linearDamping = .03f, float angularDamping = .03f) : this()
3247
{
3348
Gravity = gravity;
@@ -39,7 +54,7 @@ public void PrepareForIntegration(float dt)
3954
{
4055
//No reason to recalculate gravity * dt for every body; just cache it ahead of time.
4156
gravityDt = Gravity * dt;
42-
//Since this doesn't use per-body damping, we can precalculate everything.
57+
//Since these callbacks don't use per-body damping values, we can precalculate everything.
4358
linearDampingDt = MathF.Pow(MathHelper.Clamp(1 - LinearDamping, 0, 1), dt);
4459
angularDampingDt = MathF.Pow(MathHelper.Clamp(1 - AngularDamping, 0, 1), dt);
4560
}

0 commit comments

Comments
 (0)