I was trying use AI from FPS tutorial in another project. I think all files were right copied. AI works only partially - still running only from waypoint to waypoint. I think that more people were trying this. Maybe anybody can help.
I made a video what’s going on. Maybe there is a problem with waypoinst but now I do not know what is wrong
So he is getting stuck at the first waypoint? Do you think you could post the enemy AI code that you’re using?
I am using original scripts from the FPS tutorial without any modification. It looks like raycast from AI do not works. AI maybe can not see player in the far.
So the problem is that the enemy doesn’t follow you? or is it a waypoint problem?
I am not sure. AI walk from waypoint to waypoint or only stay on waypoint and only shoot if player is very near to the enemy.
Does it throw any exceptions?
No… Maybe someone can try use AI from FPS tutorial in 3rd Person Shooter or in the another project. I am really curious about it. It must works!
It’s kidding me. Robot AI from FPS tutorial works in the island demo.
OK. Now I know where is problem. I used first person controler from standard asset and AI works. If I assing my player or player from 3rd person shooter to Robot’s target, AI doesn’t works.
Can anybody please rewrite this code
public GameObject player;
private Vector3 aimTarget { get { return player.transform.position + new Vector3(0, 1.4f, 0); } }
in javascript? Thanks a lot.
I think you want to do it like this.
var player : GameObject;
function Update () {
var aimTarget = new Vector3(player.transform.position.x, player.transform.position.y + 1.4, player.transform.position.z);
}
If you can make player a Transform instead of a gameObject, then you can just say player.position.__ instead of player.transform.position.__.
I need to have a center of character controller set to x0 y0.8 z0 like in 3rd person shooter. But than AI doesn’t follow my player. If I have the center set to 0 0 0 AI works and follow my player. This part of code is from a orb controller. I thought it is a solution but it isn’t.
I would like really solve this question. There is a video what is the matter.I am changing the center of the character controller from 0.8 to 0.0.
I had the same thing happen to me. I think it is because the linecast call the AI uses creates a line from the pivot of the enemy to the pivot of your object then checks to see if the collider it hit was the character controller on your character, but since you ofset it upwards, the line didn’t intersect your collider. So what I ended up having to do was move the character and armature down and leave their parent the same. Or you could put all your scripts onto another object and give that a characterController and make that the parent of your character. Here’s a long shot worth trying too. For the linecast, have the endpoint of the line be .8 higher than the player position and hopefully that will ofset the controller.
Hope it helps.
Thanks Peter