constraints: Fix refcountning of constraint pt
continuous-integration/drone/push Build is failing Details

Closes: #17
pull/100/head
Joshua Ashton 5 months ago
parent 2931f2e5cf
commit 954d301a2b

@ -151,7 +151,7 @@ void JoltPhysicsConstraint::SetLinearMotor( float speed, float maxLinearImpulse
{
case CONSTRAINT_SLIDING:
{
JPH::SliderConstraint *pConstraint = static_cast<JPH::SliderConstraint *>( m_pConstraint );
JPH::SliderConstraint *pConstraint = static_cast<JPH::SliderConstraint *>( m_pConstraint.GetPtr() );
pConstraint->SetMotorState( speed ? JPH::EMotorState::Velocity : JPH::EMotorState::Off );
pConstraint->SetTargetVelocity( speed );
@ -184,7 +184,7 @@ void JoltPhysicsConstraint::SetAngularMotor( float rotSpeed, float maxAngularImp
// :/
VJoltAssert( m_pConstraint->GetSubType() == JPH::EConstraintSubType::SixDOF );
JPH::SixDOFConstraint *pConstraint = static_cast<JPH::SixDOFConstraint *>( m_pConstraint );
JPH::SixDOFConstraint *pConstraint = static_cast<JPH::SixDOFConstraint *>( m_pConstraint.GetPtr() );
pConstraint->SetTargetAngularVelocityCS( JPH::Vec3( rotSpeed, rotSpeed, rotSpeed ) );
pConstraint->SetMaxFriction( JPH::SixDOFConstraint::EAxis::RotationX, maxAngularImpulse );
pConstraint->SetMaxFriction( JPH::SixDOFConstraint::EAxis::RotationY, maxAngularImpulse );
@ -194,7 +194,7 @@ void JoltPhysicsConstraint::SetAngularMotor( float rotSpeed, float maxAngularImp
case CONSTRAINT_HINGE:
{
JPH::HingeConstraint *pConstraint = static_cast<JPH::HingeConstraint *>( m_pConstraint );
JPH::HingeConstraint *pConstraint = static_cast<JPH::HingeConstraint *>( m_pConstraint.GetPtr() );
pConstraint->SetMotorState( rotSpeed ? JPH::EMotorState::Velocity : JPH::EMotorState::Off );
pConstraint->SetTargetAngularVelocity( rotSpeed );
@ -494,7 +494,7 @@ void JoltPhysicsConstraint::InitialiseSliding( IPhysicsConstraintGroup *pGroup,
if ( sliding.velocity )
{
JPH::SliderConstraint *pConstraint = static_cast<JPH::SliderConstraint *>( m_pConstraint );
JPH::SliderConstraint *pConstraint = static_cast<JPH::SliderConstraint *>( m_pConstraint.GetPtr() );
pConstraint->SetMotorState( JPH::EMotorState::Velocity );
pConstraint->SetTargetVelocity( SourceToJolt::Distance( sliding.velocity ) );
}
@ -618,7 +618,6 @@ void JoltPhysicsConstraint::DestroyConstraint()
if ( m_pConstraint )
{
m_pPhysicsSystem->RemoveConstraint( m_pConstraint );
m_pConstraint->Release();
m_pConstraint = nullptr;
}
}

@ -88,14 +88,14 @@ private:
void DestroyConstraint();
JoltPhysicsObject *m_pObjReference = nullptr;
JoltPhysicsObject *m_pObjAttached = nullptr;
JPH::Constraint *m_pConstraint = nullptr;
constraintType_t m_ConstraintType = CONSTRAINT_UNKNOWN;
JoltPhysicsObject *m_pObjReference = nullptr;
JoltPhysicsObject *m_pObjAttached = nullptr;
JPH::Ref< JPH::Constraint > m_pConstraint;
constraintType_t m_ConstraintType = CONSTRAINT_UNKNOWN;
JoltPhysicsConstraintGroup *m_pGroup = nullptr;
JoltPhysicsConstraintGroup *m_pGroup = nullptr;
void *m_pGameData = nullptr;
JoltPhysicsEnvironment *m_pPhysicsEnvironment = nullptr;
JPH::PhysicsSystem *m_pPhysicsSystem = nullptr;
void *m_pGameData = nullptr;
JoltPhysicsEnvironment *m_pPhysicsEnvironment = nullptr;
JPH::PhysicsSystem *m_pPhysicsSystem = nullptr;
};

Loading…
Cancel
Save