Announcement

Collapse
No announcement yet.

procedural coding help with viewport/character distance needed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    procedural coding help with viewport/character distance needed

    Working with some procedural code:

    Code:
    return FMath::Clamp(FMath::CeilToInt(FMath::Log2(Size / float(CHUNK_SIZE))), 1, MAX_WORLD_DEPTH - 1);
    returns an int based on Size. I don't want to calculate based on Size only, want to generate based on 2 additional things:

    1. If character is within certain range return
    Code:
    FMath::Log2(Size / float(CHUNK_SIZE))
    2. The more complicated part:

    If character is outside of a certain range and the the object is within character viewport return an int
    Code:
    FMath::Log2(Size / float(CHUNK_SIZE))
    If the object is not within the character viewport and is also not in range I want it to be
    Code:
    FMath::Log10(Size / float(CHUNK_SIZE))
    instead.

    In essence returning a smaller exponential increase in lod on the front of a sphere with a rapid lod increase on the non-visible backside of a sphere.


    Any help/tips would be appreciated.
    Last edited by MikeRPG; 10-11-2018, 05:00 PM.

    #2
    There's a static function FVector:: Dist() to get you the distance between two vectors;

    Actor->GetLastRenderTime() will tell you if that Actor has been rendered on screen recently.
    | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

    Comment


      #3
      Originally posted by BrUnO XaVIeR View Post
      There's a static function FVector:: Dist() to get you the distance between two vectors;

      Actor->GetLastRenderTime() will tell you if that Actor has been rendered on screen recently.


      If the class in question runs procedural algorithms external to the player character how would you get the location of the player character camera to use the Dist() function?

      Followup: How would you get the camera look direction?

      Comment

      Working...
      X