13 years ago

Artificial Intelligence JavaScript Unity 3D


Advanced artificial intelligence in javaScript

#pragma strict

var alvo : GameObject;

var pos : Vector3;

var dist : float;

function Start () {

alvo = GameObject.Find (“Player”);

dist = 6;

}

function Update () {

pos = alvo.transform.position;

if(alvo && Distancia ()){

var alvoRotacao = Quaternion.LookRotation (pos - transform.position , Vector3.up);

transform.rotation = Quaternion.Slerp (transform.rotation , alvoRotacao , Time.deltaTime * 3);

}

}

function Distancia (){

if(Vector3.Distance (transform.position , pos) > dist){

return false;

}

else{

return true;

}

}



0 comments

Loading...

Next up

Been working lately on lots of 'behind-the-scenes' boring stuff that no one really cares about, so here’s a guy playing the sax for some reason.

#screenshotsaturday

Chiaki Nanami!

Here's a peaceful little forest scene for this #screenshotsaturday, from the beginning of the game.

Heya! I wanted to show some gameplay progress i made so far. I hope you like it ^^

Werehog transformation process. #sonicunleashed

A Shiny Mega Gengar 🌟 For @ManutkArt 's #ThreeColorsChallenge!

Update 2.627

New challenges & new effects!

Terraria

Rockin the Guitar, an Axe like Guitar I made for my Uni project

2d lighting experiment