Jump to content

Bone Attaching


Alienhead
 Share

Go to solution Solved by Josh,

Recommended Posts

This bug has been going on since week1 of testing..

1213193774__-Chap1-_2024-11-0520-58-33-38.thumb.gif.a5e709e825767c7dfe2587eb1e7c4e78.gif

Code:

    model:SetPosition(player.rhand:GetPosition())
    model:SetRotation(player.rhand:GetRotation())
    model:Attach(player.mesh, player.rhand)
 
Attaching a gun to the players hand bone * ( common practice ) * results in some very funky behavior.
Link to comment
Share on other sites

  • 3 months later...
  • Solution

This issue appears to be solved. When the space key is pressed the camera, light, and model will move at a speed of 60 meters per second.

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    //Get the displays
    auto displays = GetDisplays();

    //Create a window
    auto window = CreateWindow("Ultra Engine", 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/UltraEngine/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");
    Vec3 rotation;

    auto box = CreateBox(world);
    box->Move(0, 1, 0);
    box->Attach(model, neck);

    //Main loop
    while (window->Closed() == false)
    {
        if (window->KeyDown(KEY_SPACE))
        {
            model->Translate(1, 0, 0);
            camera->Translate(1, 0, 0);
            light->Translate(1, 0, 0);
        }

        world->Update();
        world->Render(framebuffer);
    }
    return 0;
}

 

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...