I’m very new to these programming languages (though I’ve used HTML and Actionscript a lot, so the logic part of it is familiar). I’ve completed just about every tutorial I could find and have really learned how to use the editor, created and imported my own assets, etc. Now I’m on to scripting, and I definitely need some help on basic concepts!
First, I’m working on some VERY rudimentary AI. A monster that walks and changes random direction every few seconds. I’m able to set up his walk animation AND get him to move, however these are the problems I’m experiencing:
-
He walks right through the terrain. I set up a capsule collider with the monster and I wouldn’t doubt there’s something more I’ll have to do, but I can’t figure out how to get him to walk ‘up the hill’ instead of through it.
-
I can not get it to set a random direction. I created a function which I thought was generating a random number between 0 and 360, set the rotation to that…however the character always rotated to the same place, not random at all…
-
Also, I thought ‘Vector3.forward’ would change based on the rotation, but even when i did successfully get my monster to rotate, forward was always the original facing direction even though now my monster was facing that new direction.
-
Trying to set up a timer so that it can call the random function after x amount of seconds.
I know these are some very basic things, and I appreciate you pros who are willing to give your time to a hobbyist like me who is intruigued by Unity and implored to take it to the next level!
Thanks!