Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void handle_WorldObjects()
- {
- // if the player gets too far from the origin, lets use the x axis
- if(playerLoc.X >= furtherestBound)
- {
- // move the player back to the origin
- // This will keep their forward movement
- if(player && player->IsValidLowLevel())
- {
- // Save the dist for objects and set the players location
- playerDist = playerLoc.X;
- player->SetActorLocation(FVector(0.f, 0.f, 0.f));
- }
- // Lets assume you store all objects in the world
- // Lets also assume we assume we have a few segments spawned
- if(listOfObjects)
- {
- for(int32 i = 0; i < listOfObject.Num() -1; i++)
- {
- // move the object toward the origin,
- // make sure to keep the spacing so the illusion is not lost
- FVector newLoc = FVector(listOfObject[i]->GetActorLocation().X - playerLoc.X, listOfObject[i]->GetActorLocation().Y, listOfObject[i]->GetActorLocation().Z);
- listOfObject[i]->SetActorLocation(newLoc);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement