Reaper_202307 Posted June 1 Share Posted June 1 I've come from the Discord, and no one seemed to know what I was referring to. I looked through the documentation, and turned up with nothing, so I figured I'd ask here. Does Ultra support Root motion natively, or would that have to be programmed in? The game I want to make relies heavily on moving characters fast and in complex patterns, so programming the motion in manually is essentially impossible, or at least improbable. 1 Quote Link to comment Share on other sites More sharing options...
Josh Posted June 1 Share Posted June 1 If you can export this motion to glTF or FBX then it should work fine in Ultra. If you upload your model we can try it and show you the result. Quote 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 More sharing options...
Solution SpiderPig Posted June 1 Solution Share Posted June 1 Thought I'd add to this here. I got it working but not very well. This is the component that made it work. class Rabbit : public Component { private: shared_ptr<Entity> controller = nullptr; shared_ptr<Entity> pivot = nullptr; Vec3 root_start_pos; public: virtual void Start() { controller = CreateBox(GetEntity()->GetWorld(), 0.1f); controller->SetCollider(nullptr); controller->SetColor(1, 0, 0); pivot = CreateSphere(GetEntity()->GetWorld(), 0.05f); pivot->SetParent(controller); pivot->SetColor(0, 1, 0); GetEntity()->SetParent(pivot); controller->Move(0, 0.05, 0); auto model = GetEntity()->As<Model>(); if (model != nullptr) { auto root = model->skeleton->FindBone("Root"); root_start_pos = root->GetPosition(); } } shared_ptr<Entity> GetPivot() { return pivot; } Vec3 last_pos; int i = 0; virtual void Update() { auto model = GetEntity()->As<Model>(); if (model != nullptr) { auto root = model->skeleton->FindBone("Root"); auto local_pos = root->GetPosition(); auto looped = false; if (local_pos.DistanceToPoint(root_start_pos) < 0.03f) { looped = true; Print("Looped" + WString(i)); i++; last_pos = Vec3(); } auto move_vec = local_pos - last_pos; last_pos = local_pos; controller->Move(move_vec); root->SetPosition(0, 0, 0); } } }; In order for it to work I need to know when the animation begins again. 1 Quote Link to comment Share on other sites More sharing options...
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.