Wildlife
- John Doom
- Posts: 126
- Joined: Wed Dec 01, 2021 5:59 pm
- Location: Italy
- Contact:
Re: Wildlife
Better in CreateBillboard. Try this:
- Attachments
-
- wildlife.zip
- (5.29 KiB) Downloaded 64 times
- BadLuckBurt
- Posts: 948
- Joined: Sun Nov 05, 2017 8:30 pm
Re: Wildlife
I tried it but it still isn't working I think. Took some more screenshots. They all end up rotated to the south-east(ish).
This zip-archive didn't have the code or I would've taken a look
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt
.
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt
.
- John Doom
- Posts: 126
- Joined: Wed Dec 01, 2021 5:59 pm
- Location: Italy
- Contact:
- BadLuckBurt
- Posts: 948
- Joined: Sun Nov 05, 2017 8:30 pm
Re: Wildlife
I'm debugging. For some reason the Random.Range call that does the Y-axis degrees is always returning the same number.
- edit
I changed the way the code executes so it spawns 1 animal per frame, the rotation works now.
I have to go walk the dog, after that I'll clean up the code and post the class back here.
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt
.
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt
.
- BadLuckBurt
- Posts: 948
- Joined: Sun Nov 05, 2017 8:30 pm
Re: Wildlife
Just quoting to make sure you get a notification
I have attached the changed Wildlife class in the zip file and will explain below what I did, I know you're more than capable of seeing what I did just by looking at the code but others might learn something too or point out errors that I made.
Anyway:
I mentioned the Update() method before but your class did not extend Monobehaviour yet so I changed the declaration to:
Code: Select all
public class Wildlife : MonoBehaviour
I've added a couple of properties to allow Update() to loop through the number of animals it needs to spawn:
Code: Select all
static bool spawnAnimals = false;
static int animalCount = 0;
static DFPosition posPixel;
static PlayerGPS playerGPS = null;
The Update() method checks if spawnAnimals is TRUE, if it is then it sets a random animalCount if that's currently 0. After that it just calls DoSpawnAnimal.
The DoSpawnAnimal now generates the rotation value and no longer has the for-loop. The rest of your code there is pretty much untouched, the rotation value gets passed to the CreateBillboard method. Once it reached the end, it decreases animalCount by 1. Once animalCount hits 0, spawnAnimals is set to false and the loop stops until the OnMapPixelChanged conditions are satisfied again.
In CreateBillboard, you will noticed that instead of setting the rotation and position values on the model, I do it on the GameObject. At some point it hit me, all those screenshots of the same animals facing the same direction is because there's only one model but many game objects. So when you manipulate the model directly, it translates to all instances of that model. Setting the rotation on the game objects works as expected, they will face different directions.
I think that about covers it, I've noticed some clipping issues when multiple animals spawn, they bunch up pretty easy but that's a matter of tweaking.
I am curious about the way you're creating these game objects. If you look at the method ImportCustomFlatGameobject in MeshReplacement.cs, that does most of what your code does. It's fine if there's a reason why you did it a different way, I'm just curious
- Attachments
-
- Wildlife_changed.zip
- (2.48 KiB) Downloaded 68 times
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt
.
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt
.
- John Doom
- Posts: 126
- Joined: Wed Dec 01, 2021 5:59 pm
- Location: Italy
- Contact:
Re: Wildlife
I don't have time to check, but I trust you. Set a new version number, add yourself too as author, post here source and dfmod and we're ready for nexus
- BadLuckBurt
- Posts: 948
- Joined: Sun Nov 05, 2017 8:30 pm
Re: Wildlife
Thank you for your confidence in me, thats quite a risk to take
I would like to work a bit on the placement of the animals before we do a new release.
As I mentioned, they tend to bunch up when more than one spawns so might as well improve their placement because people are bound to come back and report it.
I've got some time later today and will post the source + dfmod when Im done
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt
.
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt
.
- John Doom
- Posts: 126
- Joined: Wed Dec 01, 2021 5:59 pm
- Location: Italy
- Contact:
Re: Wildlife
At this point it's more important to release it, bugs can be fixed in a later updated. If placement is too problematic, I'd suggest spawning max 1-2 animals per pixel and call it a day for nowBadLuckBurt wrote: ↑Fri Jan 07, 2022 9:26 am I would like to work a bit on the placement of the animals before we do a new release.
- John Doom
- Posts: 126
- Joined: Wed Dec 01, 2021 5:59 pm
- Location: Italy
- Contact:
Re: Wildlife
Fixed direction and released on Nexus. You may move to released