Jump to content

Fog on Map, not visible on game.


Go to solution Solved by Josh,

Recommended Posts

  • 2 weeks later...
Posted

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?

Let's build cool stuff and have fun. :)

Posted

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.

 

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games

Posted

Ok, so the solution would be to create a camera on the map and search for it from the script. 

  • Like 1

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games

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.

×
×
  • Create New...