Class BuoyancyController
- Namespace
- Alis.Core.Physic.Controllers
- Assembly
- Alis.dll
The buoyancy controller class
public sealed class BuoyancyController : Controller
Inheritance
Inherited Members
Constructors
BuoyancyController(AABB, float, float, float, Vector2)
Initializes a new instance of the Alis.Core.Physic.Controllers.BuoyancyController class.
public BuoyancyController(AABB container, float density, float linearDragCoefficient, float rotationalDragCoefficient, Vector2 gravity)
Parameters
container
AABB-
Only bodies inside this AABB will be influenced by the controller
density
float-
Density of the fluid
linearDragCoefficient
float-
Linear drag coefficient of the fluid
rotationalDragCoefficient
float-
Rotational drag coefficient of the fluid
gravity
Vector2-
The direction gravity acts. Buoyancy force will act in opposite direction of gravity.
Fields
AngularDragCoefficient
Controls the rotational drag that the fluid exerts on the bodies within it. Use higher values will simulate thick fluid, like honey, lower values to simulate water-like fluids.
public float AngularDragCoefficient
Field Value
Density
Density of the fluid. Higher values will make things more buoyant, lower values will cause things to sink.
public float Density
Field Value
LinearDragCoefficient
Controls the linear drag that the fluid exerts on the bodies within it. Use higher values will simulate thick fluid, like honey, lower values to simulate water-like fluids.
public float LinearDragCoefficient
Field Value
Velocity
Acts like waterflow. Defaults to 0,0.
public Vector2 Velocity
Field Value
_container
The container
private AABB _container
Field Value
_gravity
The gravity
private readonly Vector2 _gravity
Field Value
_normal
The normal
private Vector2 _normal
Field Value
_offset
The offset
private float _offset
Field Value
_uniqueBodies
The body
private readonly ICollection<Body> _uniqueBodies
Field Value
Properties
Container
Gets or sets the value of the container
public AABB Container { get; set; }
Property Value
Methods
Update(float)
Updates the dt
public override void Update(float dt)
Parameters
dt
float-
The dt