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

Shadow The Hedgehog X pixel art

Just a Pico sprite

So here's the first of the zodiac signs i will make for the next weeks.

A Shiny Mega Gengar ๐ŸŒŸ For @ManutkArt 's #ThreeColorsChallenge!

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

It nicely separates the snowy biome from the grassy one.

It's built with painted Ebonstone.

Showing off player 2 ๐Ÿ˜Ž

What do you think?

2d lighting experiment

I did this on my 3DS ^^ #Kirby

A few screenshots of the places you'll cross in the Demo of Blu. You can play it today on #gamejolt !

Annie of the stars