Jump to content

Normal Misaligned on Brushes


Go to solution Solved by Josh,

Recommended Posts

Posted

As first mentioned here.

Normals don't return the right value with GetWorld()->Pick() on brushes. It's fine with models. 

	auto end = LoadModel(GetEntity()->GetWorld(),"Models/Developer/Widgets/normal.gltf");
	auto p0 = GetEntity()->GetPosition(true);
	auto p1 = TransformPoint(0, 0, viewdistance, GetEntity(), NULL);
	pickinfo = GetEntity()->GetWorld()->Pick(p0, p1, radius, true);
	bool lookingatvoid = !pickinfo.success;

	if (!lookingatvoid)
	{
		// Set the end point to the position.
		end->SetPosition(pickinfo.position);
		end->SetRotation(0, GetEntity()->GetRotation(true).y, 0);
		end->AlignToVector(pickinfo.normal);
	}

image.thumb.png.4d07ea4ccd8919ff74506ca3a2bb9ef7.png

Wanted to make this it's own thread so it doesn't get forgotten. 

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

  • 4 weeks later...
  • 2 weeks later...
  • Solution
Posted

Fixed on dev branch:

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    auto world = CreateWorld();

    auto brush = CreateBoxBrush(world, 1, 1, 1);

    auto pick = world->Pick(Vec3(-2), Vec3(1, 1.5, 2));

    Print(String(pick.normal.x) + ", " + String(pick.normal.y) + ", " + String(pick.normal.z));

    return 0;
}

 

  • Thanks 1

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

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