Jump to content

Recommended Posts

Posted

 

When I don't speak English, when my forte is not mathematics, that's where my perception comes into play, I know how to position rigid bodies correctly on the mesh. Now at least the AI gives me suggestions, and shows me the way to go in the project.

 

 

            -- 💎 Transformar posición del hueso a posición global
            local localPos = self.bones.head:GetPosition(true)
            local worldMatrix = self.model:GetMatrix(true)
            local worldPos = TransformPoint(localPos, worldMatrix, Mat4()) -- desde modelo ➜ mundo
            -- Posicionar la esfera en la cabeza
           self.bodies.head:SetPosition(worldPos)

 

image.thumb.png.b99a869ee5157ee6a628b2dcdab3b5e5.png

  • Like 1

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

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

Posted

After having a long conversation with an AI, I learned how to use these commands, I am not an expert, but trying to do this before was super complicated for me, because sometimes I have more desire than knowledge and that is not enough. The AI explained me the commands with details and exercises and the result is really great.  In Leadwerks 4 I couldn't do it, not because I couldn't, but because I didn't have the knowledge I have now. 

Translated with DeepL.com (free version)


image.thumb.png.8529eade20c4afbc1f348a080890bc57.png

 

 

 
    function this:UpdateBonesFromBodies()
        for name, bone in pairs(self.bones) do
            local body = self.bodies[name]
            if bone and body then
                local worldPos = body:GetPosition(true)
                local modelMatrix = self.model:GetMatrix(true)
                local localPos = TransformPoint(worldPos, Mat4(), modelMatrix) -- de mundo a modelo
                bone:SetPosition(localPos, true)
 
                local worldRot = body:GetRotation(true) -- rotación global del cuerpo físico
                local localRot = TransformRotation(worldRot, nil, self.model)
                bone:SetRotation(localRot, true)
               
   
            end
        end
    end

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

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

Posted

I'm about to give up, but I need to do this effect that keeps me awake at night. A continuous learning process, and it's not that I have the ability, it's that now I'm fighting with the AI and I'm learning by the way.

image.thumb.png.05e2ba9c6f013e4aa575cde554e000ce.png

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

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

Posted

image.thumb.png.a7956c22801a17502890acb60449f801.pngimage.thumb.png.f2e64ce4727e8efe746f46b89bb8d775.png

 

 

 Let's go with the synchronization of bones with rigid bodies and joints. 

Wood Mannequin GIF by joelremygif

  • Like 1

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

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

Posted

After struggling for a long time with this code I found the perfect solution for the compensation of bones and rigid bodies.

    function this:AlignBodyToBone(body, bone, offset)
        local worldPos = TransformPoint(bone:GetPosition(true), self.model, nil)
        if offset then
            local offsetWorld = TransformVector(offset, self.model, nil)
            worldPos = worldPos + offsetWorld
        end
        body:SetPosition(worldPos, true)
   
        local worldRot = TransformRotation(bone:GetRotation(true), self.model, nil)
        body:SetRotation(worldRot, true)
    end

 

image.thumb.png.137e0ba6dd389b6565dc0077e67dad15.png

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

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

Posted

Next steps, hud, life, oxygen, stamine etc.

image.thumb.png.3b000f4fd4fa0051ea5f4e03b945d3fb.png

 

 

  • Like 1

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

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

Posted

 

I'm still with ragdoll, I'll create a blog to comment on my experience with this new attempt.

image.thumb.png.49b5057c39dc7ba8392f71e136d6be8b.png

image.thumb.png.c82d914e000b74d0294d1f66d1451fdc.png

  • Like 1

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

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

Posted

Video Dev Log ▼01
 

Here I show what I have advanced, Leadwerks 5 is great, and I think I have improved a bit in this coding.

 

  • Like 1

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

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

Posted

Hud Player.

 

image.thumb.png.a47bff0e9df77c1f10449f4e66f1f167.png

  • Like 1

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

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

Posted

Main File Lua Script.

image.thumb.png.663a9623bde9dd12359caf9aa98d9450.png

--##************************************************##
--## Proyecto   : AstroCuco v0.0 | Pre‑Alpha        ##
--## Scripters  : Yue Rexie & Kara 💙               ##
--## Fichero    : Main.lua                          ##
--## Fecha      : 18 de Mayo 2025                  ##
--##************************************************##
--## Notas      : Fichero principal con control     ##
--##              de escenas, GUI y depuración      ##
--##************************************************##
 
--  Importación de clases base
import("Source/Classes/Window.lua")
import("Source/Classes/Input.lua")
import("Source/Classes/World.lua")
import("Source/Classes/GUI.lua")
import("Source/Classes/Debug.lua")
import("Source/Classes/UI/UI_MainMenu.lua")
import("Source/Classes/UI/UI_LoadingScene.lua")
import("Source/Classes/UI/UI_Level01.lua")
import("Source/Classes/SoundManager.lua")
import("Source/Classes/SettingsManager.lua")
import("source/Classes/Player.lua")
 
local window = Window:New("AstroCuco", 100, 100, 1280, 720)
local input = Input:New(window:GetWindow())
-- 🌍 Mundos.
local WMenu3D  = World:New("Menu3D")
local WLoading = nil
local WLevel01 = nil
 
local world = WMenu3D:GetWorld()
 
-- GUIs.
local GUIMenu3D  = GUI:New(WMenu3D, window)
local GUILoading = nil
local GUILevel01 = nil
 
local uiMainMenu = UI_MainMenu:New(GUIMenu3D, window)
local uiLoading  = nil
local uiLevel01  = nil
 
ui = uiMainMenu:Get()
 
local Ela = nil
local onLevel = 0
 
while true do
    collectgarbage()
 
    world:Update()
   
    if Ela and world:GetName() == "Level01" then
        Ela:Update()
    end
 
    if ui == uiMainMenu:Get() then
        local result = ui:Update()
 
        if result == true then
            break
        elseif result == "return_level01" then
            world = WLevel01:Get()
            ui = uiLevel01:Get()
            onLevel = 0
 
        elseif result =="scene_loading" then
 
            WLoading =  World:New("Loading")
            GUILoading = GUI:New(WLoading, window)
            uiLoading = UI_LoadingScene:New(GUILoading, window)
 
            world = WLoading:Get()
            ui = uiLoading:Get()
 
        elseif result == "restart" or result == "restart_confirm" then
 
            ui:Destroy()  
            ui = nil  
            window:Destroy()
            window = nil
            uiMainMenu:Destroy()
 
            if uiLoading then
                uiLoading:Destroy()
                uiLoading = nil
            end
            if uiLevel01 then
                uiLevel01:Destroy()
                uiLevel01 = nil
            end
            input:Destroy()
            input = nil
 
            window = Window:New("AstroCuco", 100, 100, 1280, 720)
            input = Input:New(window:GetWindow())
            GUIMenu3D = GUI:New(WMenu3D,window)
            -- Si te funciona como "uiMainMenu:New" lo dejo, pero lo ideal es llamar al constructor de clase:
            uiMainMenu = UI_MainMenu:New(GUIMenu3D,window)
 
            if  WLevel01 then
                Ela = Player:New(WLevel01,input)
                uiMainMenu:SetStartMode("continue")
                GUILevel01   = GUI:New(WLevel01, window)
                uiLevel01     = UI_Level01:New(GUILevel01, window)
            end
            ui = uiMainMenu:Get()
 
            if result == "restart" then
                uiMainMenu:ShowPanelConfirm("Do you confirm\n this new resolution?\n(" ..
                    window:GetWidth() .. " x " .. window:GetHeight() .. ")")
            end
 
        end
 
    -- Agregado: chequeo que uiLoading no sea nil antes de llamar uiLoading:Get()
    elseif uiLoading and ui == uiLoading:Get() then
 
        local result = ui:Update()
 
        if ui:GetProgress() >= 0.5  and not WLevel01 then
            uiMainMenu:SetStartMode("continue")
            input:FlushMouse()
            WLevel01 = World:New("Level01")
            GUILevel01   = GUI:New(WLevel01, window)
            uiLevel01     = UI_Level01:New(GUILevel01, window)
        end
 
        if result == "scene_level01" and WLevel01 then
            world = WLevel01:Get()
            ui = uiLevel01:Get()
 
            -- Si ya existe Ela, destruir antes de crear nueva
            if Ela then
                Ela:Destroy()
                Ela = nil
            end
            Ela = Player:New(world,input)
 
        end
 
    end
 
    -- Retornar desde el nivel
    if WLevel01 and Ela then
        if input:GetKeyUp(KEY_ESCAPE) then
            onLevel = 1 -onLevel
        end
 
        if onLevel== 1 then
            world = WMenu3D:Get()
            ui    = uiMainMenu:Get()
 
        else
            local center = input:GetWindowCenter()
            input:SetMousePosition(center.x, center.y)
            world = WLevel01:Get()
            ui    = uiLevel01:Get()
        end
 
    end
 
    world:Render(window:GetFramebuffer())
    if input:GetKeyHit(KEY_K)  then return end
 
    if input:GetKeyHit(KEY_Q) then
        -- Acción reservada
    end
end

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

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

Posted

Recovering Health.


image.thumb.png.d39c916b818c1b36ce7021cfd12b1da0.png

 

 

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...