本文整理汇总了C++中Orientation::TurnTo方法的典型用法代码示例。如果您正苦于以下问题:C++ Orientation::TurnTo方法的具体用法?C++ Orientation::TurnTo怎么用?C++ Orientation::TurnTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orientation
的用法示例。
在下文中一共展示了Orientation::TurnTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMyMission
//.........这里部分代码省略.........
pside, myPosition, dtUpdate, accuracy, speed, lifespan, OT_station,
&pmodelTarget, &distance2Min, &directionMin);
}
}
if (pmodelTarget)
{
if (m_launcher && (m_launcher->GetMission() != GetMyMission()))
m_launcher = NULL;
//It is going to shoot ... make it visible to everyone in the sector
if (!m_bSeenByAll)
{
m_bSeenByAll = true;
for (SideLinkIGC* psl = m_pMission->GetSides()->first();
(psl != NULL);
psl = psl->next())
{
IsideIGC* psideOther = psl->data();
if (!SeenBySide(psideOther))
{
//Does this side have any scanners in the sector?
ClusterSite* pcs = pcluster->GetClusterSite();
const ScannerListIGC* psl = pcs->GetScanners(psideOther->GetObjectID());
if ((psl->n() != 0) || (m_pMission->GetMissionParams()->bAllowAlliedViz && psideOther->AlliedSides(psideOther,pside))) //ALLY 7/3/09 VISIBILITY 7/11/09 imago
SetSideVisibility(psideOther, true);
else
m_bSeenByAll = false;
}
}
}
//We have a target ... fire along directionMin (modulo dispersion)
Orientation o = GetOrientation();
o.TurnTo(directionMin);
SetOrientation(o);
Vector position = myPosition + m_probeType->GetEmissionPt() * o;
DataProjectileIGC dataProjectile;
dataProjectile.projectileTypeID = m_projectileType->GetObjectID();
short nShots = 0;
do
{
//Permute the "forward" direction slightly by a random amount
dataProjectile.forward = directionMin;
if (dispersion != 0.0f)
{
float r = random(0.0f, dispersion);
float a = random(0.0f, 2.0f * pi);
dataProjectile.forward += (r * cos(a)) * o.GetRight();
dataProjectile.forward += (r * sin(a)) * o.GetUp();
dataProjectile.forward.SetNormalize();
}
//We never move, so skip all the velocity calculations
dataProjectile.velocity = speed * dataProjectile.forward;
dataProjectile.lifespan = lifespan;
IprojectileIGC* p = (IprojectileIGC*)(m_pMission->CreateObject(m_nextFire, OT_projectile,
&dataProjectile, sizeof(dataProjectile)));
assert (p);
{
p->SetLauncher(m_launcher ? ((ImodelIGC*)m_launcher) : ((ImodelIGC*)this));
p->SetPosition(position);
p->SetCluster(pcluster);
p->Release();
}
nShots++;
m_nextFire += dtimeBurst;
}
while (m_nextFire < now);
if (m_ammo > 0)
{
m_ammo -= nShots;
if (m_ammo <= 0)
{
m_ammo = 0;
GetMyMission()->GetIgcSite()->KillProbeEvent(this);
}
}
}
else
{
//No shots this cycle
m_nextFire = now;
}
}
}
TmodelIGC<IprobeIGC>::Update(now);
}
}