VCustomVolumeObject *vHavokTriggerVolume::GetOwnerCustomVolume()
{
  VisTypedEngineObject_cl *pOwner = GetOwner();
  if (!pOwner || !pOwner->IsOfType(V_RUNTIME_CLASS(VCustomVolumeObject)))
    return NULL;

  return static_cast<VCustomVolumeObject*>(pOwner); 
}
VisObject3D_cl *vHavokTriggerVolume::GetOwner3D()
{
  VisTypedEngineObject_cl *pOwner = GetOwner();
  if (pOwner == NULL)
    return NULL;

  VASSERT(pOwner->IsOfType(V_RUNTIME_CLASS(VisObject3D_cl)));
  return (VisObject3D_cl*)pOwner; 
}
// ----------------------------------------------------------------------------
bool vHavokConstraintChainRendererBase::DoInit()
{
  // Get the constraint chain that owns this component
  VisTypedEngineObject_cl *pOwner = GetOwner();
  m_pConstraintChain = (pOwner && pOwner->IsOfType(V_RUNTIME_CLASS(vHavokConstraintChain)))
    ? static_cast<vHavokConstraintChain*>(pOwner)
    : NULL;
  if (!m_pConstraintChain)
    return false;

  // Register as a rendering hook
  Vision::Callbacks.OnRenderHook += this;
  Vision::Callbacks.OnUpdateSceneBegin += this;

  return true;
}
Exemple #4
0
void RPG_Trigger::OnOverlappingCollidableRemoved(hkpCollidable *handle)
{
  // check for phantoms (character proxy objects are phantoms)
  if(handle->getType() == hkpWorldObject::BROAD_PHASE_PHANTOM)
  {
    hkpEntity* hkEntity = static_cast<hkpEntity*>(handle->getOwner());

    vHavokUserDataType_e eType = V_USERDATA_UNDEFINED;
    void *pObject = vHavokUserDataPointerPair_t::ExtractTypeAndPointer((void*)hkEntity->getUserData(), eType);

    if (pObject && eType==V_USERDATA_OBJECT)
    {
      // pObject should be a VisTypedEngineObject_cl.
      VisTypedEngineObject_cl* object = (VisTypedEngineObject_cl*)pObject;

      if(object->IsOfType(V_RUNTIME_CLASS(vHavokCharacterController)))
      {
        m_exitedEntities.Add((VisBaseEntity_cl*)(static_cast<vHavokCharacterController*>(object)->GetOwner()));
      }
    }
  }
}