Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion vphysics_jolt/vjolt_collide_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,8 @@ static void CastBoxVsShape( const Ray_t &ray, uint32 contentsMask, IConvexInfo *
if ( vjolt_trace_castbox_backface_force.GetBool() )
settings.SetBackFaceMode( JPH::EBackFaceMode::CollideWithBackFaces );
settings.mCollisionTolerance = SourceToJolt::Distance( 0.1f * 0.25f ); // Regular VPhysics uses 0.25" here for the "collision tolerance"/epsilon, but when actually testing, it uses 0.1 * epsilon, so provide that here.
settings.mUseShrunkenShapeAndConvexRadius = true;
// RaphaelIT7: This was reported to cause possibly false collision detection, this probably is because this can result in more "rounded" shapes.
// settings.mUseShrunkenShapeAndConvexRadius = true;
settings.mReturnDeepestPoint = false;

ContentsFilter_Shape filter( pShape, contentsMask, pConvexInfo );
Expand Down
13 changes: 4 additions & 9 deletions vphysics_jolt/vjolt_controller_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,19 +457,14 @@ void JoltPhysicsPlayerController::OnPostSimulate( float flDeltaTime )
Log_Msg( LOG_VJolt,
"Player State:\n"
" vOldPosition: %g %g %g\n"
" vOldVelocity: %g %g %g\n"
" vNewPosition: %g %g %g\n"
" vNewVelocity: %g %g %g\n"
" m_vLastImpulse: %g %g %g\n"
" vControllerVelocity: %g %g %g\n"
" vGroundVelocity: %g %g %g\n",
vOldPosition.x, vOldPosition.x, vOldPosition.z,
vOldVelocity.x, vOldVelocity.x, vOldVelocity.z,
" m_vLastImpulse: %g %g %g\n",
m_vOldPosition.x, m_vOldPosition.x, m_vOldPosition.z,
vNewPosition.x, vNewPosition.x, vNewPosition.z,
vNewVelocity.x, vNewVelocity.x, vNewVelocity.z,
m_vLastImpulse.x, m_vLastImpulse.x, m_vLastImpulse.z,
vControllerVelocity.x, vControllerVelocity.x, vControllerVelocity.z,
vGroundVelocity.x, vGroundVelocity.x, vGroundVelocity.z );
m_vLastImpulse.x, m_vLastImpulse.x, m_vLastImpulse.z
);
#endif
}

Expand Down
6 changes: 5 additions & 1 deletion vphysics_jolt/vjolt_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,11 @@ void JoltPhysicsObject::UpdateMaterialProperties()
{
const surfacedata_t *pSurface = JoltPhysicsSurfaceProps::GetInstance().GetSurfaceData( m_materialIndex );

m_pBody->SetRestitution( pSurface->physics.elasticity );
// RaphaelIT7: idk why but Jolt loves to create a rocket if elasticity is too high. iirc IVP internally clamps this too between 0 and 1 - atleast I think I saw it do that somewhere?
// surface properties like Metal_bouncy have a ridiculous elasticity of 1000.
// Why exactly 3.75? because it seems to be the most realistic limit to still allow for super bouncy things.
// 0 to 1 does not mean 100% bouncy here, idk why SetRestitution has no documentation.
m_pBody->SetRestitution( Clamp<float>(pSurface->physics.elasticity, 0, 3.75) );
m_pBody->SetFriction( pSurface->physics.friction );
m_flMaterialDensity = pSurface->physics.density;
m_GameMaterial = pSurface->game.material;
Expand Down
Loading