|
Post by wolfi3300 on Jan 5, 2019 12:29:03 GMT
Hi,
I am new to unity and want to make some nice games for my kiddies. At the moment I am trying to build an Dinoworld using the AI-Controller (Beta) for my Dinos.
At the moment I've 2 Dinos using this template but I see some strange effects, where I do not know, where it comes from.
1./ I built an Companion AI, but it looks like, that he does not recognize my AI-"Enemies". Found a thread, with an feedback, that Melee-Companion does not work with the AI-Controller at the moment. Okay.
2./ My Generic-Dino-AI sometimes get's a force and is thrown far in the air. Even I put a mass of 10000 in the rigidbody, but that did not change anything. Sometimes the Dinos do smaller jumps, sometimes the are thrown very high. Dont know where that comes from?
3./ Sometimes my AI-Enemies get crazy and are running in a circle. Don't know why?
Maybe somebody has an idea what's going wrong here?
Best regards, Wolfi
|
|
|
Post by tchrisbaker on Jan 6, 2019 0:53:03 GMT
1. I got a companion to work. I'm not sure if it's the most efficient or best way but it does work. This is the FSM action. As far as detecting other enemies that will just be done like you would any other AI in your FSM. You can either put the player into the player variable in the inspector or it will find it by the Player tag
using UnityEngine;
namespace Invector.vCharacterController.AI.FSMBehaviour
{
public class FollowPlayerAction :vStateAction
{
public GameObject player;
public override string defaultName
{
get
{
return "Follow Player";
}
}
public float maxDistanceToStartFollow;
public float minDistanteOfTheTarget;
public bool debugFollow;
public override void DoAction(vIFSMBehaviourController fsmBehaviour, vFSMComponentExecutionType executionType = vFSMComponentExecutionType.OnStateUpdate)
{
if (player == null) {
player = GameObject.FindGameObjectWithTag("Player");
}
FollowTarget(player.transform.position, fsmBehaviour);
}
public virtual void FollowTarget(Vector3 playerPosition, vIFSMBehaviourController fsmBehaviour)
{
var dist = Vector3.Distance(fsmBehaviour.transform.position, playerPosition);
if (debugFollow) Debug.DrawLine(fsmBehaviour.transform.position, playerPosition);
if (dist > maxDistanceToStartFollow) fsmBehaviour.aiController.MoveTo(playerPosition);
else if(dist<=minDistanteOfTheTarget) fsmBehaviour.aiController.Stop();
}
}
} [/code[
|
|
|
Post by Invector on Jan 7, 2019 22:51:42 GMT
It's something that users are often confused about, but actually the Simple Melee AI that comes with the Melee Combat Template does not work with the AI Template, meaning that the CompanionAI which is a feature from the MeleeCombat, will not work with the new AI.
We're still gonna add the Companion as a feature for the AI Template in the future.
|
|
|
Post by wolfi3300 on Jan 9, 2019 12:47:32 GMT
Thank you for answering my question 1. Any ideas what the problem is because my AI enemies sometimes get crazy and run in a circle? I see this problem often if the surface is not flat. It seams, that they loose contact to ground which triggers this behaviour.
I also run into problems with the healing pots. If I press "U" they do not charge up the Health.
And another thing. When my character dies inventory does not show up after pressing "i", I've to restart the game.
Has it something to do, that Version 1.2.4 is not available on the Asset Store?
|
|