I cannot detect software collision, ENTITY_EVENT_COLLISION in ProcessEvent

#1
我设置了一个物理参数类型是SOFT,并且设置了物理实体的一些参数,当软体发生碰撞时,我无法在 ProcessEvent 中的 ENTITY_EVENT_COLLISION 中获取碰撞信息,我想问一下是什么原因呢?
以下是我的代码:

** TRANSLATED**
I set a physical parameter type to SOFT, and set some parameters of the physical entity. When the software collides, I cannot get the collision information in the ENTITY_EVENT_COLLISION in the ProcessEvent. I want to ask what is the reason?
Below is my code

2020-11-26_174324.png
2020-11-26_174324.png (37.89 KiB) Viewed 2419 times
2020-11-26_174247.png
2020-11-26_174247.png (8.45 KiB) Viewed 2419 times
2020-11-26_174231.png
2020-11-26_174231.png (20.5 KiB) Viewed 2419 times
// Translated subject and body to English.
Further posts not in English may be removed without warning.

Re: 我无法检测软体碰撞,在ProcessEvent中的ENTITY_EVENT_COLLISION

#2
Hi bucuoyou,

Please use English on this forum, it would be acceptable to use a translation service such as google to translate to English.
Unfortunately if this isn't done the post may be removed without further notice.

To your issue, it may make sense to provide the source code in text, rather than images, so that it can be tested more easily.
Uniflare
CRYENGINE Technical Community Manager
Here to help the community and social channels grow and thrive.

My personal belongings;
Beginner Guides | My GitHub | Splash Plugin

Re: I cannot detect software collision, ENTITY_EVENT_COLLISION in ProcessEvent

#6
subclass cclothcomponent
https://github.com/CRYTEK/CRYENGINE/blo ... ponent.cpp

override and change to

Code: Select all

void CMyClothComponent::ProcessEvent(const SEntityEvent& event) { CClothComponent::ProcessEvent(event); switch (event.event) { case ENTITY_EVENT_COLLISION: { EventPhysCollision* physCollision = reinterpret_cast<EventPhysCollision*>(event.nParam[0]); const char* surfaceTypeName = ""; EntityId otherEntityId = INVALID_ENTITYID; IEntity* pOtherEntity = gEnv->pEntitySystem->GetEntityFromPhysics(physCollision->pEntity[1]); if (!pOtherEntity) return; if (ISurfaceType* pSurfaceType = gEnv->p3DEngine->GetMaterialManager()->GetSurfaceTypeManager()->GetSurfaceType(physCollision->idmat[1])) surfaceTypeName = pSurfaceType->GetName(); otherEntityId = pOtherEntity->GetId(); if (Schematyc::IObject* pSchematycObject = m_pEntity->GetSchematycObject()) // Send OnCollision signal pSchematycObject->ProcessSignal(SCollisionSignal(otherEntityId, Schematyc::SurfaceTypeName(surfaceTypeName)), GetGUID()); } break; } } Cry::Entity::EventFlags CMyClothComponent::GetEventMask() const { Cry::Entity::EventFlags bitFlags = ENTITY_EVENT_COMPONENT_PROPERTY_CHANGED | ENTITY_EVENT_START_GAME | ENTITY_EVENT_RESET | ENTITY_EVENT_DETACH_THIS| ENTITY_EVENT_COLLISION; return bitFlags; }
i guess mesh does not have collision.

Who is online

Users browsing this forum: No registered users and 1 guest

cron