我设置了一个物理参数类型是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
// Translated subject and body to English.
Further posts not in English may be removed without warning.
Re: 我无法检测软体碰撞,在ProcessEvent中的ENTITY_EVENT_COLLISION
#2Hi 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.
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
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: 我无法检测软体碰撞,在ProcessEvent中的ENTITY_EVENT_COLLISION
#3create mesh and paint vertex color, set sim property , load character , add cloth attachment ,
https://www.youtube.com/watch?v=Kqn5Yy4Je1g
https://www.youtube.com/watch?v=Kqn5Yy4Je1g
Re: 我无法检测软体碰撞,在ProcessEvent中的ENTITY_EVENT_COLLISION
#4
Last edited by mknmknjk on Sun Nov 29, 2020 12:17 pm, edited 1 time in total.
Re: 我无法检测软体碰撞,在ProcessEvent中的ENTITY_EVENT_COLLISION
#5I have read this carefully, but what I want to know is why I can't get the collision information. What should be set for software collision?
Re: I cannot detect software collision, ENTITY_EVENT_COLLISION in ProcessEvent
#6subclass cclothcomponent
https://github.com/CRYTEK/CRYENGINE/blo ... ponent.cpp
override and change to
i guess mesh does not have collision.
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;
}