Skip to content

Commit

Permalink
Added groups
Browse files Browse the repository at this point in the history
  • Loading branch information
denis authored and denis committed Nov 14, 2024
1 parent f748f81 commit 3df0690
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Engine/include/Physics/Physics.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ namespace Prisma
float mass = 0.0f;
bool dynamic = false;
bool softBody = false;
float friction = 0;
float restitution = 0;
float pressure = 0;
};

struct SoftBodySettings
Expand Down
19 changes: 19 additions & 0 deletions Engine/src/Components/PhysicsMeshComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ void Prisma::PhysicsMeshComponent::ui()
componentType = std::make_tuple(TYPES::STRINGLIST, "Collider", &m_status);
ComponentType componentMass;
componentMass = std::make_tuple(TYPES::FLOAT, "Mass", &m_collisionData.mass);
ComponentType componentFriction;
componentFriction = std::make_tuple(TYPES::FLOAT, "Friction", &m_collisionData.friction);
ComponentType componentRestitution;
componentRestitution = std::make_tuple(TYPES::FLOAT, "Restitution", &m_collisionData.restitution);
ComponentType componentPressure;
componentPressure = std::make_tuple(TYPES::FLOAT, "Pressure", &m_collisionData.pressure);
ComponentType componentIteration;
componentIteration = std::make_tuple(TYPES::INT, "Iteration", &m_settingsSoft.numIteration);
ComponentType componentDynamic;
Expand Down Expand Up @@ -49,6 +55,12 @@ void Prisma::PhysicsMeshComponent::ui()

addGlobal(componentMass);

addGlobal(componentFriction);

addGlobal(componentRestitution);

addGlobal(componentPressure);

addGlobal(componentIteration);

addGlobal(componentDynamic);
Expand Down Expand Up @@ -299,6 +311,9 @@ BodyCreationSettings Prisma::PhysicsMeshComponent::getBodySettings()
aabbSettings.mMassPropertiesOverride = mass;
aabbSettings.mOverrideMassProperties = EOverrideMassProperties::CalculateInertia;
}
aabbSettings.mFriction = m_collisionData.friction;
aabbSettings.mRestitution = m_collisionData.restitution;

aabbSettings.mUserData = uuid();
return aabbSettings;
}
Expand Down Expand Up @@ -349,6 +364,10 @@ void Prisma::PhysicsMeshComponent::addSoftBody()
sb_settings.mUpdatePosition = m_settingsSoft.updatePosition;
sb_settings.mNumIterations = m_settingsSoft.numIteration;

sb_settings.mFriction = m_collisionData.friction;
sb_settings.mRestitution = m_collisionData.restitution;
sb_settings.mPressure = m_collisionData.pressure;

m_physicsSoftId = Physics::getInstance().bodyInterface().CreateSoftBody(sb_settings);
Physics::getInstance().bodyInterface().AddBody(m_physicsSoftId->GetID(),
m_collisionData.dynamic
Expand Down

0 comments on commit 3df0690

Please sign in to comment.