So first, I’ve gotten too use to Unity where the code was simply put into little self contained scripts, such as this little guy done in C#
using UnityEngine;
using System.Collections;
class EnemyAI : MonoBehaviour {
private Transform target;
int moveSpeed;
int rotationSpeed;
int maxDistance;
private Transform myTransform;
void Awake() {
myTransform = transform;
}
// Use this for initialization
void Start () {
GameObject go = GameObject.FindGameObjectWithTag ("Player");
target = go.transform;
maxDistance = 2;
}
// Update is called once per frame
void Update () {
//Looks at target
myTransform.rotation = Quaternion.Slerp (myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);
if (Vector3.Distance (target.position, myTransform.position) > maxDistance) {
//Move towards target
myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
}
}
}
Now I’m actually attempting in translating that simple AI code into UE4, which is actually quite a challenge I’m facing. Though it would be a good base to actually start programming but I’m finding it a bit harder to get comfortable then I was hoping it would be. I’ve ran through the documentation and such and I have been trying to dissect the Bot code from the Shooter Game sample that they have. What I’m really facing in trying to accomplish this little task in the wrapper and skin of the UE4 coding structure. I was mainly hoping if someone could help explain the little nuances of coding in the program, or had time to explain a few key things in when I’m attempting to write my own code for UE4. I have to get out of the mindset of programming for Unity!
Any tips, hints, suggestions or pointers?