Creating the village

When working on the village terrain I realised that I could not make the terrain as steep as I had drawn it in my storyboard, because the characters might have trouble navigating it. I also wanted to look for how to allow the character to move along the terrain and found this video explaining the character controller, which I have not made use of before. How to Move Characters in Unity 3D: Built-In Character Controller Explained [#1] (youtube.com)

I then looked at the documentation Unity - Scripting API: CharacterController (unity3d.com)

Add 90 Degrees to Transform.Rotation - Questions & Answers - Unity Discussions

After figuring out the characters movement I then tried to make a movement script for the NPC I first tried moving the NPC in a random direction but this did not work (The character just played the rolling animation but did not move or moved very slightly) I then tried to use Transform.MoveTowards with waypoints but this did not work either. It only worked if I set the speed to 100 and then the character would teleport between locations for a minute and then get stuck. 

So I created an empty parent of the character and created an animation for it. I then searched for how to pause the animation so I could pause it while the Player talks to the NPC and then resume the animation once they are done. To do this I defined the NPC's parent Animator and in the script I set .speed to true or false.

unity - How to play and pause animation - Game Development Stack Exchange

Please help me with script making UI canvas look towards camera. - Unity Forum
I also found this useful script which made the overhead UI look at the camera. 
transform.forward = Camera.main.transform.forward;

It was challenging to make the scripts adpaptable to be used for different scenes/NPCs but I think I figured it out by defining where the script is and using if statements to use the correct code for example the different NPCs will say different things but I wanted them to use the same movement and interaction script. 
I also wrote down a list of all the different interations and the requirements for them to show, for example in order to talk to NPC 2 you would need to have talked to NPC1 first. However I decided there might be an option to skip the starting conversations and task by just going straight to the cave. 



Comments

Popular Posts