//----------------------------------------------------------------------------- // Purpose: Handles movement towards the last move target. // Input : flInterval - //----------------------------------------------------------------------------- bool CNPC_Ichthyosaur::OverrideMove( float flInterval ) { m_flGroundSpeed = GetGroundSpeed(); if ( m_bHasMoveTarget ) { DoMovement( flInterval, m_vecLastMoveTarget, ICH_MOVETYPE_ARRIVE ); } else { DoMovement( flInterval, GetLocalOrigin(), ICH_MOVETYPE_ARRIVE ); } return true; }
//----------------------------------------------------------------------------- // Purpose: // Input : *pTargetEnt - // vecDir - // flDistance - // flInterval - //----------------------------------------------------------------------------- void CNPC_Ichthyosaur::MoveFlyExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, float flDistance, float flInterval ) { IchthyosaurMoveType_t eMoveType = ( GetNavigator()->CurWaypointIsGoal() ) ? ICH_MOVETYPE_ARRIVE : ICH_MOVETYPE_SEEK; m_flGroundSpeed = GetGroundSpeed(); Vector moveGoal = GetNavigator()->GetCurWaypointPos(); //See if we can move directly to our goal if ( ( GetEnemy() != NULL ) && ( GetNavigator()->GetGoalTarget() == (CBaseEntity *) GetEnemy() ) ) { trace_t tr; Vector goalPos = GetEnemy()->GetAbsOrigin() + ( GetEnemy()->GetSmoothedVelocity() * 0.5f ); AI_TraceHull( GetAbsOrigin(), goalPos, GetHullMins(), GetHullMaxs(), MASK_NPCSOLID, GetEnemy(), COLLISION_GROUP_NONE, &tr ); if ( tr.fraction == 1.0f ) { moveGoal = tr.endpos; } } //Move DoMovement( flInterval, moveGoal, eMoveType ); //Save the info from that run m_vecLastMoveTarget = moveGoal; m_bHasMoveTarget = true; }
int main() { glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); GLFWwindow * window = glfwCreateWindow(screenWidth, screenHeight, "LearnOpenGL", nullptr, nullptr); glfwMakeContextCurrent(window); if (window == NULL) { std::cout << "Failed to create GLFW window" << std::endl; glfwTerminate(); return -1; } camera = new Camera(glm::radians(90.0f), (float)screenWidth / (float)screenHeight); glfwSetKeyCallback(window, key_callback); glfwSetCursorPosCallback(window, mouse_callback); glfwSetScrollCallback(window, scroll_callback); // Options glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); glewExperimental = GL_TRUE; if (glewInit() != GLEW_OK) { std::cout << "Failed to initialize GLEW" << std::endl; return -1; } glViewport(0, 0, screenWidth, screenHeight); GLuint uboId = GetCommonUniformBuffer(); glBindBufferBase(GL_UNIFORM_BUFFER, 0, uboId); //auto example = new ExampleIBL(); //auto example = new ExampleDeferred(); auto example = new ExampleSSAO(); example->Init(camera, uboId); while (!glfwWindowShouldClose(window)) { glfwPollEvents(); DoMovement(camera, keys); example->OnTick(); glfwSwapBuffers(window); } glfwTerminate(); return 0; }
bool C4Object::ExecMovement() // Every Tick1 by Execute { // update in which material this object is UpdateInMat(); // Containment check if (Contained) { CopyMotion(Contained); return true; } // General mobility check if (Category & C4D_StaticBack) return false; // Movement execution if (Mobile) // Object is moving { // Move object DoMovement(); // Demobilization check if ((xdir==0) && (ydir==0) && (rdir==0)) Mobile=0; // Check for stabilization if (rdir==0) Stabilize(); } else // Object is static { // Check for stabilization Stabilize(); // Check for mobilization if (!::Game.iTick10) { // Gravity mobilization xdir=ydir=rdir=0; Mobile=1; } } // Enforce zero rotation if (!Def->Rotateable) fix_r=Fix0; // Out of bounds check if ((!Inside<int32_t>(GetX() + Shape.GetX(), -Shape.Wdt, GBackWdt) && !(GetPropertyInt(P_BorderBound) & C4D_Border_Sides)) || ((GetY() + Shape.GetY() > GBackHgt) && !(GetPropertyInt(P_BorderBound) & C4D_Border_Bottom))) { C4PropList* pActionDef = GetAction(); // Never remove attached objects: If they are truly outside landscape, their target will be removed, // and the attached objects follow one frame later if (!pActionDef || !Action.Target || pActionDef->GetPropertyP(P_Procedure) != DFA_ATTACH) { bool fRemove = true; // never remove HUD objects if (Category & C4D_Parallax) { int parX, parY; GetParallaxity(&parX, &parY); fRemove = false; if (GetX()>GBackWdt || GetY()>GBackHgt) fRemove = true; // except if they are really out of the viewport to the right... else if (GetX()<0 && !!parX) fRemove = true; // ...or it's not HUD horizontally and it's out to the left else if (!parX && GetX()<-GBackWdt) fRemove = true; // ...or it's HUD horizontally and it's out to the left } if (fRemove) { AssignDeath(true); AssignRemoval(); } } } return true; }
void APlayerOvi::Tick(float DeltaSeconds){ //get own deltaTime DeltaSeconds = TimeManager::Instance()->GetDeltaTime(DeltaSeconds); Super::Tick(DeltaSeconds); //initilize raycast query param //Initialize TraceParam if (!m_isValid) { //Get ATowardsTheLightGameMode if (!m_gameMode) m_gameMode = Cast<ATowardsTheLightGameMode>(UGameplayStatics::GetGameMode(this)); m_gameMode->FindActualPlayer(); static FName FireTraceIdent = FName(TEXT("Platform")); FCollisionQueryParams TraceParams(FireTraceIdent, true, this); TraceParams.bTraceAsyncScene = true; TraceParams.bFindInitialOverlaps = false; TraceParams.bTraceComplex = true; TArray<AActor *> ignorados; for (TActorIterator<ATappable > ActorItr(GetWorld()); ActorItr; ++ActorItr) { if (ActorItr->ActorHasTag("Tappable")) ignorados.Add(*ActorItr); } for (TActorIterator<ACheckPoint > checkItr(GetWorld()); checkItr; ++checkItr) ignorados.Add(*checkItr); for (TActorIterator<ATutorial > tutItr(GetWorld()); tutItr; ++tutItr) ignorados.Add(*tutItr); if (ignorados.Num() > 0) TraceParams.AddIgnoredActors(ignorados); m_TraceParams = TraceParams; m_isValid = true; } //pause animations if is game paused Mesh->bPauseAnims = isPlayerPaused(); //first tick initialize viewport properties, dont work at begin play if (m_limitViewPort0 == 0 && m_limitViewPort1 == 0) { m_limitViewPort0 = GEngine->GameViewport->Viewport->GetSizeXY().X * 0.45; m_limitViewPort1 = GEngine->GameViewport->Viewport->GetSizeXY().X * 0.55; } //update elapsed time if push button animation is running if (m_isPushingButton) { m_elapsedButton += DeltaSeconds; if (m_elapsedButton >= 1.0f) { m_elapsedButton = 0.0f; m_isPushingButton = false; } } if (m_isPickingPortal) { m_elapsedPortal += DeltaSeconds; float t = 1.0f - (m_elapsedPortal / 1.2f); Mesh->SetRelativeScale3D(FVector(t, t, t)); if (m_elapsedPortal >= 0.6f) { m_elapsedPortal = 0.0f; m_isPickingPortal = false; Mesh->SetRelativeScale3D(FVector(1, 1, 1)); } } if (m_isPickingAltar) { m_elapsedAltar += DeltaSeconds; if (m_elapsedAltar >= 0.7f) { m_elapsedAltar = 0.0f; m_isPickingAltar = false; } } //get last position for this frame. m_lastPosition = GetActorLocation(); float value = 0.0f; if (isInputEnabled()) value = UpdateState(); else{ value = 0; m_doJump = false; } DoMovement(DeltaSeconds, value); if (!m_isPickingPortal) { DoJump(DeltaSeconds); CalculateGravity(DeltaSeconds); } CheckCollision(); CalculateOrientation(); }