Jump to content

Fog on Map, not visible on game.


Yue
 Share

Go to solution Solved by Josh,

Recommended Posts

  • 2 weeks later...

How and when is the camera created? Is it created by a component attached to the player in the scene, or is it created before the scene is loaded?

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

the camera is created at the moment the level prototype is loaded. A class creates the camera that attaches it to the player. Here a part of the code.

 

-## Define Class.
local CPlayer = {}
function CPlayer:Create(world, input)
    local this = {}

    --## Private Members.
    local me = {
        world = world,
        mesh = nil,
        character = nil,
        pivotNeck = nil,
        camera = nil,
        pivotCamera = nil,
        input = input,
        vel = 0.0,
        rot = 0.0,
        forceJump = 0.0,
        crouch = false,
        boneNeck = nil,

        freelookrotation = Vec3(0),
        mouselookspeed = 0.1,
        followdistance = 3.0,
        smoothcameradistance = 0,
        threshold = 0.1,  -- threshold for mouse movement sensitivity

        -- Animations.
        idle = "Idle",
        walk = "Walking",
        fastRun = "FastRun",
        slowRun = "SlowRun",
        crouchIdle = "CrouchIdle",
        crouchWalk = "CrouchedWalking",
        falling = "FallingIdle",
        fallingFly = "Falling",
        useTablet = "UseTablet",
        useComputer = "UseComputer",
    }

    --## Constructor.
    function me:Start()
        me:StartCamera()
        me:StartPlayer()
        me:CenterMouse()
        Print("Create Object Player ... Ok!")
    end

    function me:StartCamera()
        me.input:HideMouse()
        if me.camera == nil then
            me.camera = CreateCamera(me.world:Get())
      
      ... Continue.

 

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

  • Solution

If the camera is not created in a component, it will not inherit the scene fog settings.

  • Confused 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...