本文整理汇总了C++中Matrix34::CreateIdentity方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix34::CreateIdentity方法的具体用法?C++ Matrix34::CreateIdentity怎么用?C++ Matrix34::CreateIdentity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix34
的用法示例。
在下文中一共展示了Matrix34::CreateIdentity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessEvent
virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
{
switch (event)
{
case eFE_Initialize:
{
pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID,false);
}
case eFE_Activate:
{
if(GetPortBool(pActInfo, 1)) {
EntityId id = GetPortEntityId(pActInfo,EIP_EntityID);
IEntity * entity = gEnv->pEntitySystem->GetEntity(id);
if(entity)
{
Matrix34 trans; // = entity->GetWorldTM();
trans.CreateIdentity();
Quat quat = entity->GetRotation();
quat.v = GetPortVec3( pActInfo, EIP_Rotation_XYZ);
quat.w = GetPortFloat( pActInfo, EIP_Rotation_W);
//quat.NormalizeFast();
Vec3 position = entity->GetPos();
trans.Set(Vec3(1,1,1),quat.GetNormalized(),position);
entity->SetPosRotScale(position,quat,Vec3(1,1,1));
}
}
}
}
}
示例2: ProcessEvent
virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
{
switch (event)
{
case eFE_Initialize:{
pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID,true);
}
case eFE_Activate:
{
pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID,true);
}
break;
case eFE_Update:
{
//if (IsPortActive(pActInfo, PORT_IN_ENABLE))
//{
EntityId id = GetPortEntityId(pActInfo,EIP_EntityID);
EntityId parentid = GetPortEntityId(pActInfo,EIP_ParentEntityID);
//IGameObject *pGameObj = gEnv->pGameFramework->GetGameObject(id);
IEntity * entity = gEnv->pEntitySystem->GetEntity(id);
IEntity * parententity = gEnv->pEntitySystem->GetEntity(parentid);
if(entity){
Matrix34 trans; // = entity->GetWorldTM();
trans.CreateIdentity();
Matrix34 transparent;
transparent.CreateIdentity();
if (parententity){
//quatParent = parententity->GetRotation();
transparent = parententity->GetWorldTM();
//CryLogAlways("Parent : [%f,%f,%f]",transparent.GetColumn0().x,transparent.GetColumn0().y,transparent.GetColumn0().z);
//CryLogAlways("Parent : [%f,%f,%f]",transparent.GetColumn1().x,transparent.GetColumn1().y,transparent.GetColumn1().z);
//CryLogAlways("Parent : [%f,%f,%f]",transparent.GetColumn2().x,transparent.GetColumn2().y,transparent.GetColumn2().z);
//CryLogAlways("Parent : [%f,%f,%f]",transparent.GetColumn3().x,transparent.GetColumn3().y,transparent.GetColumn3().z);
}
Quat quat = entity->GetRotation();
quat.v = GetPortVec3( pActInfo, EIP_Rotation_XYZ);
quat.w = GetPortFloat( pActInfo, EIP_Rotation_W);
quat.NormalizeFast();
Vec3 position = GetPortVec3(pActInfo, EIP_Position);
trans.Set(Vec3(1,1,1),quat.GetNormalized(),position);
//transparent.SetTranslation(Vec3(0,0,0));
Vec3 positionlocal = transparent.TransformVector(position);
trans = transparent * trans;
//Matrix34 transresult ;
//transresult.CreateIdentity();
//transresult.Scale
trans.SetTranslation(positionlocal+parententity->GetPos());
if(trans.IsValid()){
entity->SetWorldTM(trans);
}
else {
//CryLogAlways("[%f,%f,%f]",trans.GetColumn0().x,trans.GetColumn0().y,trans.GetColumn0().z);
//CryLogAlways("[%f,%f,%f]",trans.GetColumn1().x,trans.GetColumn1().y,trans.GetColumn1().z);
//CryLogAlways("[%f,%f,%f]",trans.GetColumn2().x,trans.GetColumn2().y,trans.GetColumn2().z);
//CryLogAlways("[%f,%f,%f]",trans.GetColumn3().x,trans.GetColumn3().y,trans.GetColumn3().z);
//CryLogAlways("rot : [%f,%f,%f,%f]",trans.GetRo);
//CryLogAlways("sca : [%f,%f,%f]",trans.GetColumn0().x,trans.GetColumn0().y,trans.GetColumn0().z);
}
}
//CryLogAlways("%i",id);
//}
}
}
}