Josh Posted June 10, 2024 Posted June 10, 2024 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? Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Yue Posted June 11, 2024 Author Posted June 11, 2024 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. Quote
Solution Josh Posted June 11, 2024 Solution Posted June 11, 2024 If the camera is not created in a component, it will not inherit the scene fog settings. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Yue Posted June 13, 2024 Author Posted June 13, 2024 Ok, so the solution would be to create a camera on the map and search for it from the script. 1 Quote
Recommended Posts
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.