Yue Posted Tuesday at 04:26 PM Posted Tuesday at 04:26 PM I don't know how to explain this, but everything points to it having to do with the SetInput update. A mesh is positioned on the controller and follows it, and the mesh detaches in falling movements, depending on whether the update comes before or after the render. Now, when attaching a mesh to a specific bone, in my case the head bone, the same thing happens. but if I put it before the render, the helmet is not delayed in free fall, but the entire mesh is delayed from the SetInput controller. I found a solution to this that doesn't make much sense but works for me. If you use bone:SetScale in the main loop. boneHead:SetScale(1,1,1) boneBack:SetScale(1,1,1) everything works perfectly and behaves as I really expect it to. Quote Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games
Josh Posted Thursday at 10:54 PM Posted Thursday at 10:54 PM On 2/3/2026 at 8:26 AM, Yue said: if I put it before the render If you put what before the render? Entity:Attach() only needs to be called once. I tried producing this error but even at 60 meters per second, there is only some small floating point fluttering, nothing like you showed in your video on Discord: #include "Leadwerks.h" using namespace Leadwerks; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Leadwerks", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetFov(70); camera->Move(0, 2, -8); //Create light auto light = CreateBoxLight(world); light->SetRotation(45, 35, 0); light->SetRange(-10, 10); //Model by PixelMannen //https://opengameart.org/content/fox-and-shiba auto model = LoadModel(world, "https://github.com/Leadwerks/Documentation/raw/master/Assets/Models/Characters/Fox.glb"); model->SetScale(0.05); model->Animate(1); model->SetRotation(0, -90, 0); auto neck = model->skeleton->FindBone("b_Neck_04"); auto head = model->skeleton->FindBone("b_Head_05"); Vec3 rotation; //Model by alissvetlana //https://sketchfab.com/3d-models/hat-a7f54e87bea94730b4a1827ec1f770df auto hat = LoadModel(world, "https://github.com/Leadwerks/Documentation/raw/master/Assets/Models/Characters/hat.glb"); hat->SetScale(0.025); hat->SetPosition(-0.3, 0.4, 0); hat->Attach(model, head); //Main loop while (window->Closed() == false and window->KeyHit(KEY_ESCAPE) == false) { model->Translate(10, 0, 0); camera->Translate(10, 0, 0); world->Update(); rotation.y = Cos(float(Millisecs()) / 10.0f) * 65.0f; neck->SetRotation(rotation); world->Render(framebuffer); } return 0; } 1 Quote Let's build cool stuff and have fun.
Yue Posted 12 hours ago Author Posted 12 hours ago I think it's because something happens with the entity's SetInput for the character controller. If I put it before the render, the controller breaks with the character's mesh visible, and if I put it after the render, the case separates. My Code. --################################################################################## --## Project : Astrocuco. --## Scripter : Yue Rexie. --## File : CInv.lua. --################################################################################### --## Notes : The object is instantiated. --################################################################################### CInv = {} CInv.__index = CInv function CInv:New(meshPlayer) local this = setmetatable({}, self) local world = meshPlayer:GetWorld() local player = meshPlayer local headBone = player.skeleton:FindBone("Head", true) local helmet = LoadModel(world, "Models/Player/Helmet/Helmet.mdl") helmet:SetHidden(false) helmet:SetPosition(0,-0.1,-0.05) helmet.name = "Helmet" helmet:Attach(player,headBone) local backBone = player.skeleton:FindBone("Spine2", true) local backpack = LoadModel(world, "Models/Player/Backpack/Backpack.mdl") backpack:SetHidden(false) backpack:SetPosition(0,-0.1,0.15) backpack.name = "Backpack" backpack:Attach(player,backBone) local elbowBoneL = player.skeleton:FindBone("LeftForeArm", true) local tablet = LoadModel(world, "Models/Player/Tablet/Tablet.mdl") tablet:SetHidden(false) tablet:SetPosition(0.1,0.04,0,false) tablet:SetRotation(-5,5,0) tablet.name = "Tablet" tablet:Attach(player,elbowBoneL) function this:Update() headBone:SetScale(0.85,0.85,0.85) backBone:SetScale(1,1,1) elbowBoneL:SetScale(1,1,1) end function this:GetHelmet() return helmet end function this:GetBackpack() return backpack end function this:GetTablet() return tablet end return this end It's strange because the only way to fix it is to put it in the loop that scales the bones, and that solves it. Quote Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games
Josh Posted 11 hours ago Posted 11 hours ago When you say "it" do you mean the call to Entity:SetInput? 1 Quote Let's build cool stuff and have fun.
Yue Posted 11 hours ago Author Posted 11 hours ago 28 minutes ago, Josh said: When you say "it" do you mean the call to Entity:SetInput? Yes. 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.