示例#1
0
	void CRigidbody::processCollisionData(CollisionData& data)
	{
		if (data.collidersRaw[0] != nullptr)
		{
			CCollider* other = (CCollider*)data.collidersRaw[0]->_getOwner(PhysicsOwnerType::Component);
			data.collider[0] = other->getHandle();
		}

		if (data.collidersRaw[1] != nullptr)
		{
			CCollider* other = (CCollider*)data.collidersRaw[1]->_getOwner(PhysicsOwnerType::Component);
			data.collider[1] = other->getHandle();
		}
	}
示例#2
0
	void CCollider::triggerOnCollisionEnd(const CollisionData& data)
	{
		// Const-cast and modify is okay because we're the only object receiving this event
		CollisionData& hit = const_cast<CollisionData&>(data);
		hit.collider[0] = mThisHandle;

		if (hit.collidersRaw[1] != nullptr)
		{
			CCollider* other = (CCollider*)hit.collidersRaw[1]->_getOwner(PhysicsOwnerType::Component);
			hit.collider[1] = other->getHandle();
		}

		onCollisionEnd(hit);
	}