[Request] Collision for non-enemy flats?

Talk about the mods you'd like to see in Daggerfall Unity. Give mod creators some ideas!
Post Reply
imsobadatnicknames
Posts: 371
Joined: Sun Jun 02, 2019 4:28 pm
Location: Colombia

[Request] Collision for non-enemy flats?

Post by imsobadatnicknames »

I can't be the only one who thinks it's kinda weird that the only flats with collision are enemies, right?
I never liked the fact that you can pretty much walk right trough shopkeepers, townspeople, etc.

Would it be possible for someone to do a mod that adds collision to other flats? I'd try to do it myself but honestly the only thing I half-know how to do is using the quest system, and have no idea about C# coding or how the underlying engine works.

I think "terrain" flats like trees, bushes, rocks, etc. should probably stay intangible, otherwise it could be a really big headache for those of us who use Tedious Travel. But other than that and small flats like treasure piles I think it'd be cool if everything else was solid.
Released mods: https://www.nexusmods.com/users/5141135 ... files&BH=0
Daggerfall isn't the only ridiculously intrincate fantasy world simulator with the initials DF that I make mods for: http://www.bay12forums.com/smf/index.php?topic=177071.0

User avatar
King of Worms
Posts: 4753
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: [Request] Collision for non-enemy flats?

Post by King of Worms »

I wrote the same post 😊 so we are two.. agreed on the nature flats not being solid.

Npcs should be solid, same as animals around the towns (cows, horses etc)

User avatar
pango
Posts: 3359
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: [Request] Collision for non-enemy flats?

Post by pango »

imsobadatnicknames wrote: Tue Aug 11, 2020 2:11 am Would it be possible for someone to do a mod that adds collision to other flats? I'd try to do it myself but honestly the only thing I half-know how to do is using the quest system, and have no idea about C# coding or how the underlying engine works.
The short answer is, since those already have collider components, those must have their "isTrigger" flag turned off (so the colliders behave has obstacles rather than just triggers)

Code: Select all

diff --git a/Assets/Scripts/Game/Utility/PopulationManager.cs b/Assets/Scripts/Game/Utility/PopulationManager.cs
index fa93838d1..c49dea629 100644
--- a/Assets/Scripts/Game/Utility/PopulationManager.cs
+++ b/Assets/Scripts/Game/Utility/PopulationManager.cs
@@ -263,6 +263,10 @@ namespace DaggerfallWorkshop.Game.Utility
             GameObject go = GameObjectHelper.InstantiatePrefab(DaggerfallUnity.Instance.Option_MobileNPCPrefab.gameObject, mobileNPCName, dfLocation.transform, Vector3.zero);
             go.SetActive(false);
 
+            Collider collider = go.GetComponent<Collider>();
+            if (collider)
+                collider.isTrigger = false;
+
             // Get MobilePersonNPC reference
             MobilePersonNPC npc = go.GetComponent<MobilePersonNPC>();
 
diff --git a/Assets/Scripts/Internal/DaggerfallInterior.cs b/Assets/Scripts/Internal/DaggerfallInterior.cs
index 0b956041b..084c4305a 100644
--- a/Assets/Scripts/Internal/DaggerfallInterior.cs
+++ b/Assets/Scripts/Internal/DaggerfallInterior.cs
@@ -928,6 +928,10 @@ namespace DaggerfallWorkshop
                     // Spawn billboard gameobject
                     go = GameObjectHelper.CreateDaggerfallBillboardGameObject(obj.TextureArchive, obj.TextureRecord, node.transform);
 
+                    Collider collider = go.GetComponent<Collider>();
+                    if (collider)
+                        collider.isTrigger = false;
+
                     // Set position
                     DaggerfallBillboard dfBillboard = go.GetComponent<DaggerfallBillboard>();
                     go.transform.position = billboardPosition;
However I noticed that while commoners in the streets have capsule colliders so you can "slide" past them, other flats have box colliders so you'll get stuck on them (and after a while you start climbing their flat...), so it's only the beginning of a proper implementation...
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

Post Reply