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

Shoobies leave a sticky trail of mucus in their wake, which can impede movement for any creature that steps in it.

Path of Kami: The Evolution of the Lore

Runestones: from concept to in-game model🗿

"Our work is never over" they said.

brung back my old oc plus a new one

...they don`t have names yet tho

Hello my space friends! Now I added a space background to the ship. I love that space look but I still feel like stuff is missing. The lighting on the ship needs some improvements I think. Please tell me your opinion!

Sans Dance

Someone seems to be a little angry