News › Forums › RAIN › General Discussion and Troubleshooting › Mobile problems
This topic contains 9 replies, has 2 voices, and was last updated by soul_assassin 2 months, 3 weeks ago.
-
AuthorPosts
-
October 29, 2022 at 3:25 am #39375
Hi all.
Totally new to unity, a couple of months use, and been using rain for a couple of weeks now, and so far have been very impressed by its ease of use. Now Ive come unstuck tho! I put together a behaviour tree (see link at bottom) for a zombie using basically the same set up as the basic tutorial. i.e. idle, walk towards player, attack player. I then added a victim to my scene and added to the behaviour tree so the zombie now either heads for the player or the victim. Works absolutely fine on the PC, was really pleased when it did, but as soon as I built it for mobile it stops working. Its a multitude of problems, sometimes walk animations don’t play, sometimes he just stands there and does absolutely nothing, sometimes he idles for a while then stops completely, and about once once every ten turns it works! Try as I might I cannot get it not to work on the PC, it works every time! So after rewriting the behaviour tree about four times I have finally thrown myself on the mercy of the forums, has anyone got any pointers on how to debug my behaviour tree or have I missed something that needs to be done for a mobile build? Really run out of ideas now so any help would be fantastic!
Hope someone can help,
Thanks Paul.
ps exported the tree as XML but cant see how to post it on the forums. lol.
https://drive.google.com/file/d/0B3y14DLU6p4hQjRyOTdST2JxREU/view?usp=sharing ahh there we go. lol.- This topic was modified 3 months ago by soul_assassin.
October 29, 2022 at 5:33 am #39377Actually after reading a guide to behaviour trees on the tinternet think it`s probably my lack of knowledge that’s the main problem here. I`ll have another go, wish me luck.
Thanks Paul.November 1, 2022 at 12:37 pm #39393Something to note, your problems may lie somewhere else altogether. To get an idea of what is happening on the mobile side, try to get access to the log file on that device and see if there are any warnings/exceptions in it.
Behavior trees can be complex, but between mobile and PC there is very little difference in how they work (for RAIN at least).
November 4, 2022 at 12:59 pm #39409Hi Sigil thanks for the response. I managed to get my tree running in the end apart from it would work fine 9 times out of ten and then the animation would stop on the walk animation although the zombie was still moving. After reading through the forums there was mention of using mecanim instead of legacy. So I spent my days off learning about Mecanim and rewriting my tree, works perfectly now, which is great. Chases after the player, idles, attacks etc. only problem I have now is when I generated a Navmesh he gets stuck still moving on any object in his way and kinda slides around it. Ive searched the forums and theres a post that says its to do with body transforms? Or do I need some sort of turn animation in my blend tree? At the moment I`m just using a speed variable which seems to work fine when there`s no navmesh, zombie turns fine. Any help would be appreciated, I feel a bit one step forward, two back at the mo.
Thanks in advance for any help once again!
Paul.November 4, 2022 at 1:26 pm #39411You would need a turn animation if you have Use Root Motion on, and have Override Root Rotation off on the Mecanim Motor. We generally recommend having Override Root Rotation on in most cases as it can get difficult managing both movement and turning for the AI with root motion.
There shouldn’t be a difference between turning when there is and isn’t a Navigation Mesh present. When there is a Navigation Mesh present it will use that to figure out a path to its target, when there isn’t a mesh present it’ll head straight towards it instead. Currently RAIN’s Navigation Mesh doesn’t handle dynamic obstacles, which would also cause the behavior you describe, but you can use Unity’s navigation mesh in that case (there is a thread going around here where I wrote a custom motor to do that, I can link it if you need it).
November 4, 2022 at 2:12 pm #39412Hi sigil thanks for the quick reply, I added turn animations to see if that would help and toggled root rotation on and off, but he still seems to slide around things, I turned on the path and he doesn’t seem to be following the green line accurately always slightly off. I took a video to explain,
https://drive.google.com/file/d/0B3y14DLU6p4hcm5PRjBvN19yUUE/view?usp=sharing
I`m sure its probably me again but any ideas?
Sorry for taking up your time with something basic like this, but thanks so much for helping!
Paul.November 4, 2022 at 2:47 pm #39413Just to test, disable the colliders on the boxes. He’ll obviously just walk through them, but I am curious if he is following the path at all or if something else is happening.
November 4, 2022 at 3:08 pm #39415Turned the colliders off and he walks in a straight line to the camera, as if hes not connected to the navmesh for some reason?
November 4, 2022 at 4:52 pm #39416This definitely sounds like Override Root Rotation is off, and you want that on. The default values aren’t very good on the Mecanim Motor as that should always be on to start with.
If Override Root Rotation is on, and he is still going in a straight line, turn off Use Root Motion (on both the Mecanim Motor and on the Animator itself, although I’m not sure that last one matters) and let me know if anything changes.
November 5, 2022 at 4:18 am #39417Hi Sigil sorry I disappeared off, I`m in the UK and start work at 5am so bedtime was calling. Lol. Thankyou so much! That did it! Turned off root motion on the Mecanim motor and straight away he headed for the path and stuck to it. Awesome! Any idea why this happens? Does seem a bit counter intuitive to turn root motion off. You were also right that turning it off on the Animator made no difference. Anyway thankyou once again for your fantastic help and quick response, from now on my zombies will always be called Sigils in your honour. lol.
Paul. -
AuthorPosts
You must be logged in to reply to this topic.