cleanup
This commit is contained in:
@@ -104,13 +104,12 @@ impl FixedVelocityConstraint {
|
|||||||
|
|
||||||
#[cfg(feature = "dim2")]
|
#[cfg(feature = "dim2")]
|
||||||
let mut rhs =
|
let mut rhs =
|
||||||
params.velocity_solve_fraction * Vector3::new(lin_dvel.x, lin_dvel.y, ang_dvel);
|
Vector3::new(lin_dvel.x, lin_dvel.y, ang_dvel) * params.velocity_solve_fraction;
|
||||||
|
|
||||||
#[cfg(feature = "dim3")]
|
#[cfg(feature = "dim3")]
|
||||||
let mut rhs = params.velocity_solve_fraction
|
let mut rhs = Vector6::new(
|
||||||
* Vector6::new(
|
|
||||||
lin_dvel.x, lin_dvel.y, lin_dvel.z, ang_dvel.x, ang_dvel.y, ang_dvel.z,
|
lin_dvel.x, lin_dvel.y, lin_dvel.z, ang_dvel.x, ang_dvel.y, ang_dvel.z,
|
||||||
);
|
) * params.velocity_solve_fraction;
|
||||||
|
|
||||||
let velocity_based_erp_inv_dt = params.velocity_based_erp_inv_dt();
|
let velocity_based_erp_inv_dt = params.velocity_based_erp_inv_dt();
|
||||||
if velocity_based_erp_inv_dt != 0.0 {
|
if velocity_based_erp_inv_dt != 0.0 {
|
||||||
@@ -316,12 +315,11 @@ impl FixedVelocityGroundConstraint {
|
|||||||
|
|
||||||
#[cfg(feature = "dim2")]
|
#[cfg(feature = "dim2")]
|
||||||
let mut rhs =
|
let mut rhs =
|
||||||
params.velocity_solve_fraction * Vector3::new(lin_dvel.x, lin_dvel.y, ang_dvel);
|
Vector3::new(lin_dvel.x, lin_dvel.y, ang_dvel) * params.velocity_solve_fraction;
|
||||||
#[cfg(feature = "dim3")]
|
#[cfg(feature = "dim3")]
|
||||||
let mut rhs = params.velocity_solve_fraction
|
let mut rhs = Vector6::new(
|
||||||
* Vector6::new(
|
|
||||||
lin_dvel.x, lin_dvel.y, lin_dvel.z, ang_dvel.x, ang_dvel.y, ang_dvel.z,
|
lin_dvel.x, lin_dvel.y, lin_dvel.z, ang_dvel.x, ang_dvel.y, ang_dvel.z,
|
||||||
);
|
) * params.velocity_solve_fraction;
|
||||||
|
|
||||||
let velocity_based_erp_inv_dt = params.velocity_based_erp_inv_dt();
|
let velocity_based_erp_inv_dt = params.velocity_based_erp_inv_dt();
|
||||||
if velocity_based_erp_inv_dt != 0.0 {
|
if velocity_based_erp_inv_dt != 0.0 {
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ impl VelocityConstraint {
|
|||||||
let mut rhs = (1.0 + is_bouncy * manifold_point.restitution)
|
let mut rhs = (1.0 + is_bouncy * manifold_point.restitution)
|
||||||
* (vel1 - vel2).dot(&force_dir1);
|
* (vel1 - vel2).dot(&force_dir1);
|
||||||
rhs += manifold_point.dist.max(0.0) * inv_dt;
|
rhs += manifold_point.dist.max(0.0) * inv_dt;
|
||||||
rhs *= params.velocity_solve_fraction;
|
rhs *= is_bouncy + is_resting * params.velocity_solve_fraction;
|
||||||
rhs += is_resting * velocity_based_erp_inv_dt * manifold_point.dist.min(0.0);
|
rhs += is_resting * velocity_based_erp_inv_dt * manifold_point.dist.min(0.0);
|
||||||
|
|
||||||
constraint.elements[k].normal_part = VelocityConstraintElementPart {
|
constraint.elements[k].normal_part = VelocityConstraintElementPart {
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ impl VelocityGroundConstraint {
|
|||||||
let mut rhs = (1.0 + is_bouncy * manifold_point.restitution)
|
let mut rhs = (1.0 + is_bouncy * manifold_point.restitution)
|
||||||
* (vel1 - vel2).dot(&force_dir1);
|
* (vel1 - vel2).dot(&force_dir1);
|
||||||
rhs += manifold_point.dist.max(0.0) * inv_dt;
|
rhs += manifold_point.dist.max(0.0) * inv_dt;
|
||||||
rhs *= params.velocity_solve_fraction;
|
rhs *= is_bouncy + is_resting * params.velocity_solve_fraction;
|
||||||
rhs += is_resting * velocity_based_erp_inv_dt * manifold_point.dist.min(0.0);
|
rhs += is_resting * velocity_based_erp_inv_dt * manifold_point.dist.min(0.0);
|
||||||
|
|
||||||
constraint.elements[k].normal_part = VelocityGroundConstraintElementPart {
|
constraint.elements[k].normal_part = VelocityGroundConstraintElementPart {
|
||||||
|
|||||||
Reference in New Issue
Block a user