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

Bandana Dee the Dream Friend

Chiaki Nanami!

Today I was setting up the location of the first boss. His name is "Father" and he is the first of the Patagonians. His task is to guard the road to the House.🛡🗡 Bookmark pre-launch page🔖🔖🔖

https://www.kickstarter.com/projects/rdvindiegame/the-patagonian…

Werehog transformation process. #sonicunleashed

What you all think

Today I tackled drawing different variations of facial expressions for one of the main characters in Eden. What do you think of it? :) Eden: https://gamejolt.com/games/Eden/592698

A 1h30 painting, coffee break.

My twitter: https://twitter.com/loupil100

What Are You Doing In My Swamp!?

Now spruce forest monsters can vomit forest shields, but Brutal Castle will not stop!

#gamedev #pixelart #indie

Minecraft battle: NOOB vs PRO vs HACKER vs GOD: BUILDING BEN 10 in Minecraft

(sound ON 🔊) We changed the tree harvesting selection sounds. Again.

Should we stop already? Let us know!

Find out more about the game on Steam:

http://bit.ly/AtS_New_Sounds_GJ