Yue Posted April 20 Posted April 20 I am creating a cube for my third person camera pivot. But the cube is not visible, although the camera is pivoting to its position. Camera3rdPerson = {} Camera3rdPerson.__index = Camera3rdPerson function Camera3rdPerson:New(world) local this = setmetatable({}, Camera3rdPerson) Print("✅ [Camera3rdPerson] Sistema de cámara orbital inicializado.") -- 🌌 Crear cámara vinculada al mundo local camera = CreateCamera(world:GetWorld()) camera:SetOrder(-1) -- Se renderiza primero camera:SetPosition(0,2,-2) local pivotCamera = CreateBox(world:GetWorld(), 0.2) pivotCamera:SetColor(1, 1, 0, 1) -- Amarillo brillante para debug pivotCamera:SetPosition(0, 2, 0,true) -- Altura media, ajustable luego camera:Point(pivotCamera) The cube is there, the camera is looking at it. function this:Update() --Print("📡 [Camera] Update activo en Nivel01.") pivotCamera:Move(0,0.001,0) end The cube is visible and starts to move upwards . Quote Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games
Yue Posted April 20 Author Posted April 20 Temporary solution --------------------------------------------------- -- 🔁 Actualizar posición de la cámara cada frame --------------------------------------------------- function this:Update() --Print("📡 [Camera] Update activo en Nivel01.") if self._forceCheck then local _ = pivotCamera:GetHidden() self._forceCheck = false end end Quote Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games
Josh Posted April 22 Posted April 22 In your code above pivotCamera is being declared as a local variable. The real mystery is how the program is not crashing in the Update method, since there is no global pivotCamera value declared? I need to see your whole code file to tell what is going on. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Yue Posted April 23 Author Posted April 23 4 hours ago, Josh said: In your code above pivotCamera is being declared as a local variable. The real mystery is how the program is not crashing in the Update method, since there is no global pivotCamera value declared? I need to see your whole code file to tell what is going on. Ok i sent the file by inbox Quote Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games
Josh Posted April 23 Posted April 23 I don't see any error in your code. I will need to full project in order to investigate this. Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Josh Posted April 30 Posted April 30 Closing due to lack of information. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Yue Posted April 30 Author Posted April 30 1 hour ago, Josh said: Closing due to lack of information. At the moment, until now I see it. Wait, I'll send you the project inbox. Quote Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games
Yue Posted April 30 Author Posted April 30 Ok, I already sent the project. Sorry, I had not noticed this entry. Quote Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games
Josh Posted May 15 Posted May 15 This is what I see when I run the project: You code is using 0 for the size of the box, which will make it not visible. local pivotPlayer = CreateBox(world, 0) When I changed the size to 0.2, I see this: How do I make the bug occur? 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Yue Posted May 15 Author Posted May 15 Here video. Quote Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games
Solution Josh Posted May 16 Solution Posted May 16 In your video you are declaring the box variable as a local variable. Therefore, it will go out of scope and be deleted on the next garbage collection cleanup. When I declared it as a global variable it works as expected. Player.lua 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Yue Posted May 16 Author Posted May 16 Thanks You. 1 Quote Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games
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.