bool BGE::GravityGame::Initialise() { std::shared_ptr<Ground> ground = make_shared<Ground>(); SetGround(ground); shared_ptr<Box> box = make_shared<Box>(10, 10, 10); box->Attach(make_shared<Steerable3DController>(Content::LoadModel("cobramk3"))); box->transform->position = glm::vec3(-10, 50, 0); Attach(box); return Game::Initialise(); }
/** Compute undistorted focal plane coordinate from ground position * * @param lat planetocentric latitude in degrees * @param lon planetocentric longitude in degrees * * @return conversion was successful */ bool RadarGroundMap::SetGround(const double lat, const double lon) { return SetGround(lat,lon,GetRadius(lat,lon)); }
/** * Compute undistorted focal plane coordinate from ground position. * * @param surfacePoint Ground surface point * * @return @b bool Indicates whether the conversion was successful. * * @internal */ bool VimsGroundMap::SetGround(const SurfacePoint &surfacePoint) { return SetGround(surfacePoint.GetLatitude(), surfacePoint.GetLongitude()); // return SetGroundwithLatitudeLongitude(surfacePoint.GetLatitude(), surfacePoint.GetLongitude()); }
bool CDeathPirate::CheckCollision(CBase* pBase) { CBase::CheckCollision( pBase ); if(pBase->GetType() == OBJ_BLOCK) { CBlock* BLOCK = (CBlock*)pBase; RECT rIntersect; //Descriptive replacement variables RECT rMyRect = { (LONG)GetPosX(), (LONG)GetPosY(), 0, 0 }; rMyRect.right = rMyRect.left + GetWidth(); rMyRect.bottom = rMyRect.top + GetHeight(); RECT rHisRect = { (LONG)BLOCK->GetPosX(), (LONG)BLOCK->GetPosY(), 0, 0 }; rHisRect.right = rHisRect.left + BLOCK->GetWidth(); rHisRect.bottom = rHisRect.top + BLOCK->GetHeight(); if( IntersectRect( &rIntersect, &rMyRect, &rHisRect ) ) { if( (rIntersect.right-rIntersect.left) > (rIntersect.bottom-rIntersect.top) ) { if(BLOCK->GetBlock() == BLOCK_SOLID || BLOCK->GetBlock() == BLOCK_MOVING || BLOCK->GetBlock() == BLOCK_PARTIAL || BLOCK->GetBlock() == BLOCK_UNSTABLE) { if(rMyRect.bottom > rHisRect.top && rMyRect.top < rHisRect.top) { SetPosY( (float)rHisRect.top - GetHeight() ); SetGround(true); SetBaseVelY(0); SetCollision(true); } else if(rMyRect.top < rHisRect.bottom && rMyRect.bottom > rHisRect.top) SetPosY((float)rHisRect.bottom); } else if(BLOCK->GetBlock() == BLOCK_TRAP) { SetGround(true); SetCollision(true); SetBaseVelY(0); } } else if((rIntersect.right-rIntersect.left) < (rIntersect.bottom-rIntersect.top)) { if(BLOCK->GetBlock() == BLOCK_SOLID || BLOCK->GetBlock() == BLOCK_MOVING || BLOCK->GetBlock() == BLOCK_PARTIAL) { } else if(BLOCK->GetBlock() == BLOCK_TRAP) { SetGround(true); SetCollision(true); SetBaseVelY(0); } } return true; } } if(GetGround() && GetCollision() == false) { SetGround(false); } return false; }