removed old damping

main
Benjamin Kraft 2 years ago
parent 3be7bfafb2
commit dbb0a2b687
  1. BIN
      Content/BP_Gamemode.uasset
  2. BIN
      Content/Blueprints/BP_Puma.uasset
  3. BIN
      Content/Blueprints/BP_Robot.uasset
  4. BIN
      Content/Levels/Main.umap
  5. 22
      Source/PBDRobotics/Joint.cpp

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -27,8 +27,6 @@ Vector3d UJoint::GetSecondWorldAxis() const{
return SecondLink->Orientation * SecondRotateAxis; return SecondLink->Orientation * SecondRotateAxis;
} }
void UJoint::SolvePosition(const double H) const{ void UJoint::SolvePosition(const double H) const{
ULink* L1 = FirstLink; ULink* L1 = FirstLink;
ULink* L2 = SecondLink; ULink* L2 = SecondLink;
@ -109,7 +107,16 @@ void UJoint::SolvePosition(const double H) const{
void UJoint::SolveVelocity(const double H) const{ void UJoint::SolveVelocity(const double H) const{
ULink* L1 = FirstLink; ULink* L1 = FirstLink;
ULink* L2 = SecondLink; ULink* L2 = SecondLink;
constexpr double A = 7; // Damping strength
const double Damp = 1 - (A * H < 0.5 ? A * H : 0.5);
L1->Velocity *= Damp;
L2->Velocity *= Damp;
L1->AngularVelocity *= Damp;
L2->AngularVelocity *= Damp;
/*
// Positional Damping // Positional Damping
{ {
const Vector3d V1 = L1->Velocity; const Vector3d V1 = L1->Velocity;
@ -136,14 +143,6 @@ void UJoint::SolveVelocity(const double H) const{
//L1->AngularVelocity += I1.inverse() * R1.cross(P); //L1->AngularVelocity += I1.inverse() * R1.cross(P);
//L2->AngularVelocity -= I2.inverse() * R2.cross(P); //L2->AngularVelocity -= I2.inverse() * R2.cross(P);
constexpr double A = 7;
const double Damp = 1 - A * H;
L1->Velocity *= Damp;
L2->Velocity *= Damp;
L1->AngularVelocity *= Damp;
L2->AngularVelocity *= Damp;
} }
// Rotational Damping // Rotational Damping
@ -153,6 +152,7 @@ void UJoint::SolveVelocity(const double H) const{
} }
*/
} }
UJoint::UJoint() UJoint::UJoint()

Loading…
Cancel
Save