-
Posts
2,423 -
Joined
-
Last visited
Community Answers
-
SpiderPig's post in Root motion for character animations? was marked as the answer
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.
-
SpiderPig's post in 2nd UV coord set not working? was marked as the answer
Um.... this isn't a bug. It's my code, the 2nd coord set was being overwritten elsewhere that I had forgotten about. Sorry Josh.
-
SpiderPig's post in Steam - debug build of game failing to start was marked as the answer
I see of lot of information on the web saying you not allowed to redistribute the debug DLL's. I don't know why considering you can just download visual studio and get them anyway. So I guess I'll just make it that if anyone wants to run the debug build they need to install visual studio.
-
SpiderPig's post in Editing an Asset will not update in editor was marked as the answer
This is working fine now with build 611.
-
SpiderPig's post in LOD's casting shadow when they shouldn't was marked as the answer
Nice, pretty sure it's fixed now.
-
SpiderPig's post in AppendFile was marked as the answer
Thanks, I just figured it out. I just needed to add a line to an existing file.
auto stream = OpenFile(path + "\\Game.log"); if (stream != nullptr) { auto pos = stream->GetSize(); stream->Seek(pos); stream->WriteLine(line.ToString()); stream->Close(); }
-
SpiderPig's post in Shader extension not supported was marked as the answer
There is a CurrentTime variable in UniformBlocks.glsl that you can use.
-
SpiderPig's post in Geometry Shader and Matrix Multiplication was marked as the answer
Once again simply posting has helped solve the problem... This is not the correct order to multiply matrices in.
localVertPos *= inverse(projectionMatrix); localVertPos *= inverse(entityMatrix); This is.
localVertPos = inverse(projectionMatrix) * localVertPos; localVertPos = inverse(entityMatrix) * localVertPos; And the other issue of points all appearing in the centre of the mesh. Both vertex and geometry shaders need to be in the mask section of a shader family.
-
SpiderPig's post in Does Texture::SetPixels() destroy current texture in GPU memory? was marked as the answer
I think I've fixed it!
Thanks very much for your help, with your input it made me look in the right places. It was the sun direction calculation, I had missed a simple multiplication.
-
SpiderPig's post in Creating a process in LUA was marked as the answer
Never mind, it was an easy fix in C#.
-
SpiderPig's post in Component runtime was marked as the answer
I can't see anything else wrong with your code but I'm no lua expert so I'm just rattling off things that might help now... world not null?
-
SpiderPig's post in RGBA to Float was marked as the answer
intBitsToFloat() Funny how simply making a post can make the answer show up on your next google search.
-
SpiderPig's post in How to MIRROR a camera rendertarget? was marked as the answer
I'd reverse the U coord of the entities texture coords somehow. You might need a shader for that for a render target though.
-
SpiderPig's post in Panel texture not showing with 3D cam was marked as the answer
I fixed it
auto ui = CreateInterface(world, font, framebuffer->size); ui->background->SetColor(0, 0, 0, 0); ui->SetRenderLayers(RENDERLAYER_1);//<----- Needs this!!
-
SpiderPig's post in Documentation Error was marked as the answer
Just a minor error in the C++ section for Framebuffer::Capture()
auto path = GetPath(PATH_DESKTOP) .. "/screenshot.jpg"; pixmap:Save(path); Should be:
auto path = GetPath(PATH_DESKTOP) + "/screenshot.jpg"; pixmap->Save(path);
-
SpiderPig's post in debug library is damaged was marked as the answer
Debug and Release are working okay for me. Did you try a clean install?
-
SpiderPig's post in Widget stays on screen after deleting it via SetParent (NULL) in 3D UI was marked as the answer
Just tested this. Button needs to be set to nullptr (NULL) so that it is no longer keeping the widget alive. You need to do both of these to delete the widget. Well, it goes off screen so I'm going to assume it's gone for good.
button->SetParent(nullptr); button = nullptr;
-
SpiderPig's post in GetCollider()->IntersectsPoint() return true for an old collider position was marked as the answer
I think there's a TransformPoint function that takes a source and target matrix... the matrix for your point might just be Mat4() with no arguments. Target matrix would be the models matrix.
-
SpiderPig's post in "Wrong number of primitive indices" was marked as the answer
For a line mesh AddPrimitive() should only take 2 arguments. 1 vertex for each end of a line.
-
SpiderPig's post in fullbright surface? was marked as the answer
There's bloom.lua in the posteffects folder under the shaders folder in your project. I think you add that to your camera as a post effect.
For an emission shader I think you just need to change the shader from diffuse.shader to emission.shader in the material editor. I haven't used Leadwerks in a while though.
-
SpiderPig's post in glslangValidator with global include paths? was marked as the answer
And the answer is :
#include "../../../../../../../../UltraEngine/Templates/Common/Shaders\Base\Materials.glsl" Relatively speaking.
-
SpiderPig's post in Test if SDF surface is inside AABB was marked as the answer
I believe I have found a solution. If the node's corners are all above OR all below a surface (so a voxel index of 0 or 255) then the corner with the shortest distance is retrieved and it's distance is tested against half the radius of a sphere that encompasses all of the nodes corners (the distance from one of the corners to the centre of the bounds). This way it ensures that the surface is not within the bounds of the node. It creates nearly double the amount of nodes, and I dare say 30 to 40% of them don't represent the surface, but it fixes the gaps in the mesh and it's still fast. Exploring the 4k terrain only uses about 100k nodes so it's not bad at all. Fingers crossed it holds up!
-
SpiderPig's post in Visual editor ETA was marked as the answer
There is no editor yet and I believe Josh said that the price of $7.99 will stay the same if your subscription stays current. I think the price goes up to around 10 when Ultra is more stable.
-
SpiderPig's post in Creating a class for initial system. was marked as the answer
Are you just wondering how to define the variables? In which case you simply enclose the class name like this:
shared_ptr<World> world;
-
SpiderPig's post in Terrain Overlay Texture was marked as the answer
I've just realised there's probably no way to blend it seeing as Ultra can use so many different terrain materials. I guess though you could assign a material per channel and do something like what I think I just got working...
for (int y = 0; y < 512; y++) { for (int x = 0; x < 512; x++) { auto value = terrain_gen->GetErrosion(x, y); if (value != 0.0f) { terrain->SetMaterial(x, y, rocks, value); } } }