本文整理汇总了C++中Plane::SetOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ Plane::SetOrigin方法的具体用法?C++ Plane::SetOrigin怎么用?C++ Plane::SetOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plane
的用法示例。
在下文中一共展示了Plane::SetOrigin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessControls
//.........这里部分代码省略.........
float accelerating = lengine->GetScale().x;
if(keys[SDLK_RIGHT]) // If the right arrow key is pressed
{
ship->Rotate(glm::vec3(0.0f,0.0f,+rotSpeed)); // Rotate the ship clockwise
}
if(keys[SDLK_LEFT]) // If the right arrow key is pressed
{
ship->Rotate(glm::vec3(0.0f,0.0f,-rotSpeed)); // Rotate the ship clockwise
}
if(keys['w'])
{
if(magnitude > -maxspeed) // If the throttle is less than max
{
vel += 0.5f*dir*acceleration;
}
else
{
vel -= maxspeed;
}
if(accelerating < 1.0f)
accelerating += .05f;
else
accelerating = 1.0f;
}
else
{
if(accelerating > 0)
accelerating -= .05f;
else
accelerating = 0.0f;
}
if(vel.x > 0 && vel.x < 0.1f) // If the throttle is close to zero
{
vel.x=0; // Go ahead and set it to zero (no need to waste fuel)
}
if(vel.y > 0 && vel.y < 0.1f) // If the throttle is close to zero
{
vel.y=0; // Go ahead and set it to zero (no need to waste fuel)
}
if(vel.x < 0 && vel.x > -0.1f) // If the throttle is close to zero
{
vel.x=0; // Go ahead and set it to zero (no need to waste fuel)
}
if(vel.y < 0 && vel.y > -0.1f) // If the throttle is close to zero
{
vel.y=0; // Go ahead and set it to zero (no need to waste fuel)
}
glm::vec3 pos = ship->GetPosition();
if(pos.x > WM->GetWindowWidth()+16.0f)
{
pos.x = -16.0f;
ship->SetPosition(pos);
}
else if(pos.x < -16.0f)
{
pos.x = WM->GetWindowWidth()+16.0f;
ship->SetPosition(pos);
}
if(pos.y > WM->GetWindowHeight()+16.0f)
{
pos.y = -16.0f;
ship->SetPosition(pos);
}
else if(pos.y < -16.0f)
{
pos.y = WM->GetWindowHeight()+16.0f;
ship->SetPosition(pos);
}
ship->SetThrottle(vel);
ship->Translate(vel);
pos = ship->GetPosition();
glm::vec3 rot = glm::vec3(0,0,-(atan2(mouse_x-pos.x,mouse_y-pos.y)+3.14159)*180/3.14159);
ship->SetRotation(rot);
if(!lengine || !rengine)
return;
lengine->SetOrigin(-50,0);
lengine->SetPosition(pos);
lengine->SetRotation(rot);
float lscalemod = rand()%10/100.0f-0.05f;
float rscalemod = rand()%10/100.0f-0.05f;
glm::vec3 lscale = glm::vec3(accelerating+lscalemod,accelerating+lscalemod,accelerating+lscalemod);
glm::vec3 rscale = glm::vec3(accelerating+rscalemod,accelerating+rscalemod,accelerating+rscalemod);
lengine->SetScale(lscale);
rengine->SetScale(rscale);
rengine->SetPosition(pos);
rengine->SetRotation(rot);
}
}