Jump to content

Grid Alignment Issues


reepblue
 Share

Go to solution Solved by Josh,

Recommended Posts

When resizing the grid in the editor, I notice that the reported grid sizes go by the following.

  • 5.0mm
  • 1.0
  • 2.0
  • 4.0
  • 8.0
  • 16.0
  • 32.0
  • 64.0
  • 1.3
  • 2.6
  • 5.1
  • 10.2

I dunno if this is just visual but I've ran into an issue with brushes no longer being on the grid when making geometry and I'm under the impression this is the cause. 

While I'm here, placing models doesn't feel right like it was in Leadwerks. I'm having issues placing models exactly where I want them. This seems to be the issue of the drag and drop system. To guarantee the model is on the grid, I have to set the position to 0,0,0 and then everything seems to work as intended. 

I should point out that most of my trouble is working with the 2D grid viewports. 

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

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

Link to comment
Share on other sites

The grid measurements are correct, it's just that the string formatting was rounding off one decimal place. I adjusted it so it allows two decimal spaces when needed.

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

  • Solution

There was a problem with the model drag-and-drop.

  • In the 2D viewports the position was not being rounded to the grid units.
  • The dropped coordinate was calculated wrong, and was offset by the window titlebar.

With brush editor, the edges are not intended to snap to the grid position if the grid size is bigger than when the brush was created. The grid determines the increments by which things change. The Leadwerks way was the sloppily coded approach, the Ultra way is what I actually wanted.

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

When you drag a model onto the surface it does a pick to see if something is hit, and if so it drops the model in the picked position.

If we want the position to be rounded to the grid, then it is probably necessary to take into consideration the picked normal.

For example, if that floor does not line up to the grid size vertically, you almost certainly would still want to use the Y component of the pick as the position, without any rounding.

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

18 minutes ago, Josh said:

When you drag a model onto the surface it does a pick to see if something is hit, and if so it drops the model in the picked position.

Ok, this makes sense why it's not working as intended. I don't think the AlignToVector/pickinfo.normal on brushes is working as intended. 

This is my visual result on a model:

image.thumb.png.73f43768bb0631790f88d310a3a909b9.png

Same code on the brush

image.thumb.png.4d07ea4ccd8919ff74506ca3a2bb9ef7.png

All I'm doing is:

	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, InteractionPickFilter);
	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);
	}

Edit: Maybe it doesn't have anything to do with it? It's a bug regardless..

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

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

Link to comment
Share on other sites

Thought so (It's still a bug tho).

27 minutes ago, Josh said:

If we want the position to be rounded to the grid, then it is probably necessary to take into consideration the picked normal.

This is why I thought it was the normal messing this up. Read this too fast. 

While the current system is correct I don't think it feels right. In Leadwerks, placing models in the scene snaps the model to the nearest grid point. This felt great especially when the model's origin accommodated the model. I don't want to manually type in the entity's position to get it back on the grid. 

This is what I want in the new editor with the option to turn it off for more natural placement of objects for rocks and such. 

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

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

Link to comment
Share on other sites

When dragging a model into the 3D viewport, if it is dropped onto an existing surface, the final position will now be rounded off to the grid size. I am not 100% satisfied with this behavior, but I don't know yet how to round it to the grid size while staying aligned to the plane of the picked position / normal.

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

Most of the time, I place objects in the 2D view since it's closer to the File Browser panel. Maybe that should be more grid locked than the 3D view port? One of the few reasons I would use the 3D view to place objects would be to place objects on surfaces having the model's align to the surfaces normal which doesn't seem to be in the editor currently afaik. 

Also one feature (or bug) I don't like is when you place an object on the Top 2D grid view and the item gets placed on it's side. It's like the Top grid viewport is being handled the same way as Back/Side.

I'll try to play with your changes tonight and get back to you.

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

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

Link to comment
Share on other sites

9 hours ago, Josh said:

When dragging a model into the 3D viewport, if it is dropped onto an existing surface, the final position will now be rounded off to the grid size. I am not 100% satisfied with this behavior, but I don't know yet how to round it to the grid size while staying aligned to the plane of the picked position / normal.

I got to play with it and my first reaction was:

iFunny :)

The example models snap right into place where I want it to go. It feels so much better. For uniformed models, this is perfect, but I understand not every model is like this. Making brushes seems much better, but it might be a placebo effect. I'll have to play with it more. 

But I was the only one complaining about this, I guess let's see if anyone else finds this a step forward or backward.

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

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

Link to comment
Share on other sites

2 hours ago, reepblue said:

But I was the only one complaining about this, I guess let's see if anyone else finds this a step forward or backward.

I'm looking forward to trying it out. I noticed the behavior but didn't really think much about it.

i now hate love C++

Beeeeeeeeeeeeeep~~This is a test of the emergency signature system~~Beeeeeeeeeeeeeep

RX 6800XT | i5-13600KF | 32GB DDR5 | 1440p is perfect

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