本文整理汇总了C++中Matrix34::SetRotation33方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix34::SetRotation33方法的具体用法?C++ Matrix34::SetRotation33怎么用?C++ Matrix34::SetRotation33使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix34
的用法示例。
在下文中一共展示了Matrix34::SetRotation33方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//------------------------------------------------------------------------
IMPLEMENT_RMI(CC4Projectile, ClSetPosition)
{
Matrix34 mat;
mat.SetRotation33(Matrix33(params.rot));
mat.SetTranslation(params.pos);
GetEntity()->SetWorldTM(mat);
m_stuck = true;
return true;
}
示例2: SpawnImpactEffect
void CBurnEffectManager::SpawnImpactEffect(const EventPhysCollision& pCollision, const char* effectName)
{
Vec3 surfaceNormal = pCollision.n;
Vec3 surfacePosition = pCollision.pt;
CItemParticleEffectCache& particleCache = g_pGame->GetGameSharedParametersStorage()->GetItemResourceCache().GetParticleEffectCache();
IParticleEffect* pParticleEffect = particleCache.GetCachedParticle(effectName);
if (pParticleEffect)
{
Matrix34 loc;
loc.SetIdentity();
loc.SetTranslation(surfacePosition);
loc.SetRotation33(OrthoNormalVector(surfaceNormal));
pParticleEffect->Spawn(false, loc);
}
}
示例3: NetSetStuck
void CStickyProjectile::NetSetStuck(CProjectile* pProjectile, bool stuck)
{
if(stuck && ((m_flags&eSF_IsStuck)==0))
{
IEntity* pTargetEntity = gEnv->pEntitySystem->GetEntity(m_parentId);
if(pTargetEntity)
{
if(ICharacterInstance* pTargetCharacter = pTargetEntity->GetCharacter(0))
{
const char* boneName = pTargetCharacter->GetICharacterModel()->GetICharacterModelSkeleton()->GetJointNameByID(m_stuckJoint);
if(AttachToCharacter(pProjectile, *pTargetEntity, *pTargetCharacter, boneName))
{
IActor* pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pTargetEntity->GetId());
m_flags |= eSF_IsStuck;
m_flags |= pActor ? pActor->IsPlayer() ? eSF_StuckToPlayer : eSF_StuckToAI : 0;
m_childId = pProjectile->GetEntityId();
}
}
}
if((m_flags&eSF_IsStuck)==0)
{
IEntity* pProjectileEntity = pProjectile->GetEntity();
AttachTo(pProjectile, pTargetEntity);
m_childId = pProjectileEntity->GetId();
if(pTargetEntity) //If we have a parent then the stuck position/rotation are local to the parent
{
pProjectileEntity->SetPos(m_stuckPos);
pProjectileEntity->SetRotation(m_stuckRot);
}
else if(m_flags&eSF_OrientateToCollNormal)
{
Matrix34 mat;
mat.SetTranslation(m_stuckPos);
mat.SetRotation33(Matrix33(m_stuckRot));
pProjectileEntity->SetWorldTM(mat);
}
else
{
pProjectileEntity->SetPos(m_stuckPos);
}
m_flags |= eSF_IsStuck;
}
}
}
示例4: GetEntity
//---------------------------------------------------------------------
//This function is only executed on the server
void CC4Projectile::StickToStaticObject(EventPhysCollision *pCollision, IPhysicalEntity *pTarget)
{
//Calculate new position and orientation
Matrix34 mat;
Vec3 pos = pCollision->pt+(pCollision->n*0.05f);
mat.SetRotation33(Matrix33::CreateOrientation(-pCollision->n,GetEntity()->GetWorldTM().TransformVector(Vec3(0,0,1)),gf_PI));
Vec3 newUpDir = mat.TransformVector(Vec3(0,0,1));
pos += (newUpDir*-0.1f);
mat.SetTranslation(pos+(newUpDir*-0.1f));
GetEntity()->SetWorldTM(mat);
GetGameObject()->SetAspectProfile(eEA_Physics, ePT_Static);
pos = mat.GetTranslation();
Quat rot = GetEntity()->GetWorldRotation();
if(gEnv->bMultiplayer)
GetGameObject()->InvokeRMI(CC4Projectile::ClSetPosition(),ProjectileStaticParams(pos,rot),eRMI_ToAllClients);
}
示例5: CreateBurnEffect
void CBurnEffectManager::CreateBurnEffect(const EventPhysCollision& pCollision, CBurnEffectManager::SBurnPoint* pBurnPoint)
{
Vec3 surfaceNormal = pCollision.n;
Vec3 hitDir(ZERO);
if (pCollision.vloc[0].GetLengthSquared() > 1e-6f)
{
hitDir = pCollision.vloc[0].GetNormalized();
}
Vec3 surfacePosition = pCollision.pt;
Vec3 halfVector = (surfaceNormal + (-hitDir)).GetNormalized();
CItemParticleEffectCache& particleCache = g_pGame->GetGameSharedParametersStorage()->GetItemResourceCache().GetParticleEffectCache();
IParticleEffect* pParticleEffect = particleCache.GetCachedParticle(pBurnPoint->m_pBurnParams->m_effectName);
if (pParticleEffect)
{
Matrix34 loc;
loc.SetIdentity();
loc.SetTranslation(surfacePosition);
loc.SetRotation33(OrthoNormalVector(surfaceNormal));
IParticleEmitter* pEffect = pParticleEffect->Spawn(false, loc);
if(pEffect)
{
pEffect->AddRef();
pBurnPoint->m_effect = pEffect;
const ParticleParams& particleParams = pParticleEffect->GetParticleParams();
pBurnPoint->m_attachType = particleParams.eAttachType;
pBurnPoint->m_attachForm = particleParams.eAttachForm;
}
UpdateBurnEffect(pBurnPoint);
}
UpdateBurnEffect(pBurnPoint);
}
示例6: if
//-----------------------------------------------
//This function is only executed on the server
void CC4Projectile::Stick(EventPhysCollision *pCollision)
{
assert(pCollision);
int trgId = 1;
IPhysicalEntity *pTarget = pCollision->pEntity[trgId];
if(pTarget == GetEntity()->GetPhysics())
{
trgId = 0;
pTarget = pCollision->pEntity[trgId];
}
//Do not stick to breakable glass
if(ISurfaceType *pSurfaceType = gEnv->p3DEngine->GetMaterialManager()->GetSurfaceType(pCollision->idmat[trgId]))
{
if(pSurfaceType->GetBreakability()==1)
{
m_notStick = true;
return;
}
}
IEntity *pTargetEntity = pTarget ? gEnv->pEntitySystem->GetEntityFromPhysics(pTarget) : 0;
if(pTarget && (!pTargetEntity || (pTargetEntity->GetId() != m_ownerId)))
{
//Special cases
if(pTargetEntity)
{
//Stick to actors using a character attachment
CActor *pActor = static_cast<CActor *>(gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pTargetEntity->GetId()));
//Not in MP
if(pActor && gEnv->bMultiplayer)
{
m_notStick = true;
return;
}
if(pActor && pActor->GetHealth()>0)
{
if(pActor->GetActorSpecies()!=eGCT_HUMAN)
{
m_notStick = true;
return;
}
if(StickToCharacter(true,pTargetEntity))
{
GetGameObject()->SetAspectProfile(eEA_Physics, ePT_None);
m_stuck = true;
}
m_notStick = true;
return;
}
//Do not stick to small objects...
if(!pActor)
{
pe_params_part pPart;
pPart.ipart = 0;
if(pTarget->GetParams(&pPart) && pPart.pPhysGeom && pPart.pPhysGeom->V<0.15f)
{
m_notStick = true;
return;
}
}
}
else if(pTarget->GetType()==PE_LIVING)
{
m_notStick = true;
return;
}
if(!pTargetEntity)
StickToStaticObject(pCollision,pTarget);
else
{
//Do not attach to items
if(g_pGame->GetIGameFramework()->GetIItemSystem()->GetItem(pTargetEntity->GetId()))
{
m_notStick = true;
return;
}
Matrix34 mat = pTargetEntity->GetWorldTM();
mat.Invert();
Vec3 pos = mat.TransformPoint(pCollision->pt);
mat.SetIdentity();
mat.SetRotation33(Matrix33::CreateOrientation(-pCollision->n,GetEntity()->GetWorldTM().TransformVector(Vec3(0,0,1)),gf_PI));
mat.SetTranslation(pos);
//Dephysicalize and stick
GetGameObject()->SetAspectProfile(eEA_Physics, ePT_None);
//.........这里部分代码省略.........