Help Finding Location Data

Discuss modding questions and implementation details.
Post Reply
l3lessed
Posts: 1399
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Help Finding Location Data

Post by l3lessed »

Does anyone know how to grab the location of individual buildings? I can only grab the location of the rmb automap building. I need the building models location in world position, but in the editor it shows it as combined models.

Same with npc billboards and wandering npcs within a radius?
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

l3lessed
Posts: 1399
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Help Finding Location Data

Post by l3lessed »

So, I figured out the math for it, but now I hit road block 2.

So, to get the buildings proper world location, you have to grab two things. First the rmbblock world position then the objects/buildings model position within the block.

The models position will be set as a child of the rmbblock under the combined model mesh.

So, by adding the building position to the rmb world position, it seems to get the proper world position of the model.

However, how the heck do I get the proper transform world positions of a rmbblock that contains all this?
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Help Finding Location Data

Post by Hazelnut »

Not sure, but I am mystified as to why you want to.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

l3lessed
Posts: 1399
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Help Finding Location Data

Post by l3lessed »

I need to place a mesh above them, so there is some form of a indicator for the differing types of buildings in the minimap mod I am working on. Right now, the minimap finds the game object, creates a mesh, assigns the mesh to the automap/minimap layer/camera only, and then attaches it to said object as a child to the parents transform; Right now, it attaches to any type of game npc and assigns a colored sphere mesh to show on the minimap.

I can grab npcs through streaming world asset and use GetComponent methods so I can attach a minimap marker to them. Now, all I need is to be able to mark buildings, but I need to be able to get/calculate the buildings position in the world space.

Is there a way to position an object using a parent object as the starting transform spot? I found how to grab the blocks world position.

One last trick I'm going to try is trying to grab the static doors in the blocks, shoot a spherecast off them, detect the building that is hit, and assign proper gui mesh. I have to hope I can get the static doors world locations easier though for this to work.

I'm taking a break from this though. Spent hours yesterday slamming my head against the block creation code to end up without a solution still.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

l3lessed
Posts: 1399
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Help Finding Location Data

Post by l3lessed »

Well, I might have a hacky solution. There is a online documentation on grabbing triangles and verts from a combined mesh model. Maybe I can get what I need this way?

https://www.habrador.com/tutorials/unit ... ove-trees/
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

l3lessed
Posts: 1399
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Help Finding Location Data

Post by l3lessed »

I figured it out! :o :shock: :lol: :P

Man, did it take some object magic. So, you can do it, but you have to do it by grabbing the blocks as straight DaggerfallRMBBlock objects, grabbing the doors in those blocks, using the door to grab the building key, use the building key to grab the building summary, use the building summary to grab the building position within the block. Now we have what we need to compute.

Now take the building position and add it to the rmbblock transform position. This gives you the exact center of the building within the world space by using the rmbblock as the starting point.

I need to do a few small things to get it lined up with the minimap camera height wise, put in a building type check so I can assign unique colors like in the automap, and then I'll video it for you.

Now, the only thing bugging me is that in dungeons, the minimap is like a cheat window, since it revels everything from a top down perspective, including secret passages/doors. If I could get in some form of shader to hide everything except what is in front of the player in dungeons, it would be perfect in my eyes.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

l3lessed
Posts: 1399
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Help Finding Location Data

Post by l3lessed »

Here you fools go. Very first pass with the code setup to implement the building indicator system. From here on, it is easy; I need to setup the cases for each building type and change the color based on building type. I will also add a alpha layer to the shader, so the indicator icons can be set to whatever transperency we want.

There is a few small sizing/rotation placement bugs you will notice, where some indicators aren't at the right rotation for the building. This can be fixed I'm sure.


Since I was able to get both the building position and size in world space, I was able to position the indicator right above the buildings specific height and resize it to match the buildings dimensions. I then was able to create a text mesh via code, set it up, and then put it right above the indicator so indicators could have text in them.

*Edit*
Just added transparency to indicators. They can now be as transparent or solid as you like; just have to setup settings for users.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

l3lessed
Posts: 1399
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Help Finding Location Data

Post by l3lessed »

Here it is running in a stand alone build without issue. One last thing, I need to disable the collider for the meshes, so they don't mess with any objects in the world.

My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

l3lessed
Posts: 1399
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Help Finding Location Data

Post by l3lessed »

Well, dungeons are officially in using the games built in shader material, so it only updates what you have discovered already like the origina. I'll add a detection code for attaching indicators to npcs, so they only appear once heard or seen.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

l3lessed
Posts: 1399
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Help Finding Location Data

Post by l3lessed »

Close to finishing the dungeon minimap. I have successfully accessed the automap mesh renderer objects and have the player camera check if the automap/mini mesh they are seeing has been enabled or not. If it isn't, it will enable it updating the minimap with the newest mesh/room; this way you can't cheat by seeing everything and get the more classic dungeon feel/look.

However, either my work computer is a real POS potateo machine or I have programmed in some accidently memory leaks into this mod, as the editor is eating more and more ram everything I run the mod. It eats so much ram that it usually freezes the editor on my work machine. I probably am accidently doing some loop that is loading some object or component over and over until all the ram is gone.

Anyways, at this point I have programmed and figured out all the objects and properties to get a nice look minimap for any location.

One small thing I was able to do yesterday also was grab the building model, change all its materials to a transperency material, and then place it. Now the minimap icons match the houses perfectly, and this will also allow me to do one last great feature for scrubs: a first person map assistor.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

Post Reply