本文整理汇总了C++中Vec3d::slen方法的典型用法代码示例。如果您正苦于以下问题:C++ Vec3d::slen方法的具体用法?C++ Vec3d::slen怎么用?C++ Vec3d::slen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vec3d
的用法示例。
在下文中一共展示了Vec3d::slen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: anim
void SpacePlane::anim(double dt){
WarSpace *ws = *w;
if(!ws){
st::anim(dt);
return;
}
if(bbody && !warping){
const btTransform &tra = bbody->getCenterOfMassTransform();
pos = btvc(tra.getOrigin());
rot = btqc(tra.getRotation());
velo = btvc(bbody->getLinearVelocity());
}
/* forget about beaten enemy */
if(enemy && (enemy->getHealth() <= 0. || enemy->w != w))
enemy = NULL;
Mat4d mat;
transform(mat);
if(0 < health){
Entity *collideignore = NULL;
if(ai){
if(ai->control(this, dt)){
ai->unlink(this);
ai = NULL;
}
if(!w)
return;
}
else if(task == sship_undock){
if(undocktime < 0.){
inputs.press &= ~PL_W;
task = sship_idle;
}
else{
inputs.press |= PL_W;
undocktime -= dt;
}
}
else if(controller){
}
else if(!enemy && task == sship_parade){
Entity *pm = mother ? mother->e : NULL;
if(mother){
if(paradec == -1)
paradec = mother->enumParadeC(mother->Frigate);
Vec3d target, target0(1.5, -1., -1.);
Quatd q2, q1;
target0[0] += paradec % 10 * 300.;
target0[2] += paradec / 10 * -300.;
target = pm->rot.trans(target0);
target += pm->pos;
Vec3d dr = this->pos - target;
if(dr.slen() < .10 * .10){
q1 = pm->rot;
inputs.press &= ~PL_W;
// parking = 1;
this->velo += dr * (-dt * .5);
q2 = Quatd::slerp(this->rot, q1, 1. - exp(-dt));
this->rot = q2;
}
else{
// p->throttle = dr.slen() / 5. + .01;
steerArrival(dt, target, pm->velo, 1. / 10., 1.);
}
}
else
task = sship_idle;
}
else if(task == sship_idle){
if(race != 0 /*RandomSequence((unsigned long)this + (unsigned long)(w->war_time() / .0001)).nextd() < .0001*/){
command(&DockCommand());
}
inputs.press = 0;
}
else{
inputs.press = 0;
}
}
else{
this->w = NULL;
return;
}
st::anim(dt);
// inputs.press is filtered in st::anim, so we put tefpol updates after it.
for(int i = 0; i < engines.size(); i++) if(pf[i]){
pf[i]->move(mat.vp3(engines[i]), avec3_000, cs_orangeburn.t, !(inputs.press & PL_W));
}
// engineHeat = approach(engineHeat, direction & PL_W ? 1.f : 0.f, dt, 0.);
// Exponential approach is more realistic (but costs more CPU cycles)
engineHeat = direction & PL_W ? engineHeat + (1. - engineHeat) * (1. - exp(-dt)) : engineHeat * exp(-dt);
#if 0
if(p->pf){
//.........这里部分代码省略.........