Skip to content

Commit

Permalink
UPBGE: Implement KX_CollisionContactPoint.combinedRollingFriction.
Browse files Browse the repository at this point in the history
  • Loading branch information
panzergame committed Jun 11, 2017
1 parent a31e011 commit 65ad95b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ base class --- :class:`CValue`

:type: float

.. attribute:: combinedRollingFriction

The combined rolling friction of the owner and collider object.

:type: float

.. attribute:: combinedRestitution

The combined restitution of the owner and collider object.
Expand Down
7 changes: 7 additions & 0 deletions source/gameengine/Ketsji/KX_CollisionContactPoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ PyAttributeDef KX_CollisionContactPoint::Attributes[] = {
KX_PYATTRIBUTE_RO_FUNCTION("worldPoint", KX_CollisionContactPoint, pyattr_get_world_point),
KX_PYATTRIBUTE_RO_FUNCTION("normal", KX_CollisionContactPoint, pyattr_get_normal),
KX_PYATTRIBUTE_RO_FUNCTION("combinedFriction", KX_CollisionContactPoint, pyattr_get_combined_friction),
KX_PYATTRIBUTE_RO_FUNCTION("combinedRollingFriction", KX_CollisionContactPoint, pyattr_get_combined_rolling_friction),
KX_PYATTRIBUTE_RO_FUNCTION("combinedRestitution", KX_CollisionContactPoint, pyattr_get_combined_restitution),
KX_PYATTRIBUTE_RO_FUNCTION("appliedImpulse", KX_CollisionContactPoint, pyattr_get_applied_impulse),
KX_PYATTRIBUTE_NULL //Sentinel
Expand Down Expand Up @@ -113,6 +114,12 @@ PyObject *KX_CollisionContactPoint::pyattr_get_combined_friction(PyObjectPlus *s
return PyFloat_FromDouble(self->m_collData->GetCombinedFriction(self->m_index, self->m_firstObject));
}

PyObject *KX_CollisionContactPoint::pyattr_get_combined_rolling_friction(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_CollisionContactPoint *self = static_cast<KX_CollisionContactPoint *>(self_v);
return PyFloat_FromDouble(self->m_collData->GetCombinedRollingFriction(self->m_index, self->m_firstObject));
}

PyObject *KX_CollisionContactPoint::pyattr_get_combined_restitution(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_CollisionContactPoint *self = static_cast<KX_CollisionContactPoint *>(self_v);
Expand Down
1 change: 1 addition & 0 deletions source/gameengine/Ketsji/KX_CollisionContactPoints.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class KX_CollisionContactPoint : public CValue
static PyObject *pyattr_get_world_point(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *pyattr_get_normal(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *pyattr_get_combined_friction(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *pyattr_get_combined_rolling_friction(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *pyattr_get_combined_restitution(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *pyattr_get_applied_impulse(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef);

Expand Down
6 changes: 6 additions & 0 deletions source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3443,6 +3443,12 @@ float CcdCollData::GetCombinedFriction(unsigned int index, bool first) const
return point.m_combinedFriction;
}

float CcdCollData::GetCombinedRollingFriction(unsigned int index, bool first) const
{
const btManifoldPoint& point = m_manifoldPoint->getContactPoint(index);
return point.m_combinedRollingFriction;
}

float CcdCollData::GetCombinedRestitution(unsigned int index, bool first) const
{
const btManifoldPoint& point = m_manifoldPoint->getContactPoint(index);
Expand Down
1 change: 1 addition & 0 deletions source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ class CcdCollData : public PHY_CollData
virtual MT_Vector3 GetWorldPoint(unsigned int index, bool first) const;
virtual MT_Vector3 GetNormal(unsigned int index, bool first) const;
virtual float GetCombinedFriction(unsigned int index, bool first) const;
virtual float GetCombinedRollingFriction(unsigned int index, bool first) const;
virtual float GetCombinedRestitution(unsigned int index, bool first) const;
virtual float GetAppliedImpulse(unsigned int index, bool first) const;
};
Expand Down
1 change: 1 addition & 0 deletions source/gameengine/Physics/Common/PHY_DynamicTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class PHY_CollData
virtual MT_Vector3 GetWorldPoint(unsigned int index, bool first) const = 0;
virtual MT_Vector3 GetNormal(unsigned int index, bool first) const = 0;
virtual float GetCombinedFriction(unsigned int index, bool first) const = 0;
virtual float GetCombinedRollingFriction(unsigned int index, bool first) const = 0;
virtual float GetCombinedRestitution(unsigned int index, bool first) const = 0;
virtual float GetAppliedImpulse(unsigned int index, bool first) const = 0;
};
Expand Down

0 comments on commit 65ad95b

Please sign in to comment.