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

So

i may or may not make an full art of some person or i may just leave this like that-

We are under attack!

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

"Our work is never over" they said.

The whole squad is here!

Interested? Follow me!

Demonstration of the spells and their effects :)!

A house I've built a while ago. :)

It nicely separates the snowy biome from the grassy one.

It's built with painted Ebonstone.

Terraria

Why walk when you can jump?

a drawing I did because I was bored😪. But I love how it turned out.😊