本文整理汇总了C++中Ball::GetBB方法的典型用法代码示例。如果您正苦于以下问题:C++ Ball::GetBB方法的具体用法?C++ Ball::GetBB怎么用?C++ Ball::GetBB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ball
的用法示例。
在下文中一共展示了Ball::GetBB方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void Update(Ball ball) {
bb.SetBB(m_pt, {m_size,0,m_size/2});
m_wheel_angle -= dir*speed;
if(!bb.CollisionCheck(ball.GetBB()))
m_pt.x += dir*speed;
if(bb.CollisionCheck(ball.GetBB()))
m_pt.x -= dir*speed*1.1;
if (m_pt.x-m_size < -floor_size)
{
dir *= -1;
m_pt.x = -floor_size+m_size;
}
if (m_pt.x+ m_size > floor_size)
{
dir *= -1;
m_pt.x = floor_size-m_size;
}
}
示例2: Keyboard
void Keyboard(unsigned char key, int x, int y)
{
{
if (key == 'd' || key == 'D') {
Ball temp;
temp.SetPt(ball.GetPt());
temp.Move(-1, Rotate_Speed, { 1,0,0 });
temp.Update();
if(!temp.GetBB().CollisionCheck(crane.GetBB()))
ball.Move(-1, Rotate_Speed, { 1,0,0 });
}
if (key == 'a' || key == 'A') {
Ball temp;
temp.SetPt(ball.GetPt());
temp.Move(1, Rotate_Speed, { 1,0,0 });
temp.Update();
if (!temp.GetBB().CollisionCheck(crane.GetBB()))
ball.Move(1, Rotate_Speed, { 1,0,0 });
}
if (key == 'q' || key == 'Q') {
Ball temp;
temp.SetPt(ball.GetPt());
temp.Move(-1, Rotate_Speed, { 0,1,0 });
temp.Update();
if (!temp.GetBB().CollisionCheck(crane.GetBB()))
ball.Move(-1, Rotate_Speed, { 0,1,0 });
}
if (key == 'e' || key == 'E') {
Ball temp;
temp.SetPt(ball.GetPt());
temp.Move(1, Rotate_Speed, { 0,1,0 });
temp.Update();
if (!temp.GetBB().CollisionCheck(crane.GetBB()))
ball.Move(1, Rotate_Speed, { 0,1,0 });
}
if (key == 's' || key == 'S') {
Ball temp;
temp.SetPt(ball.GetPt());
temp.Move(-1, Rotate_Speed, { 0,0,1 });
temp.Update();
if (!temp.GetBB().CollisionCheck(crane.GetBB()))
ball.Move(-1, Rotate_Speed, { 0,0,1 });
}
if (key == 'w' || key == 'W') {
Ball temp;
temp.SetPt(ball.GetPt());
temp.Move(1, Rotate_Speed, { 0,0,1 });
temp.Update();
if (!temp.GetBB().CollisionCheck(crane.GetBB()))
ball.Move(1, Rotate_Speed, { 0,0,1 });
}
if (key == 'l' || key == 'L') {
camera.HandleAngle(Camera_Speed, { 1,0,0 });
}
if (key == 'j' || key == 'J') {
camera.HandleAngle(-Camera_Speed, { 1,0,0 });
}
if (key == 'i' || key == 'I') {
camera.HandleAngle(Camera_Speed, { 0,1,0 });
}
if (key == 'k' || key == 'K') {
camera.HandleAngle(-Camera_Speed, { 0,1,0 });
}
if (key == 'u' || key == 'U') {
camera.HandleAngle(Camera_Speed, { 0,0,1 });
}
if (key == 'o' || key == 'O') {
camera.HandleAngle(-Camera_Speed, { 0,0,1 });
}
if (key == '+') {
camera.HandleDistance(10);
}
if (key == '-') {
camera.HandleDistance(-10);
}
if (key == 'r' || key == 'R') {
camera.init();
ball.init();
}
}
if (key == 'p' || key == 'P') {
exit(0);
} // Á¾·á
}