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

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

What do you think guys in my robot?Just a beginner in 3d modeling..

My instagram https://www.instagram.com/rojhonbb/

Why walk when you can jump?

Regular exercise is key for healthy wings.

Try it out!

https://gamejolt.com/games/AeonNightmares/605184

Cash Banooca

2d lighting experiment

Explosive domino effect

Super Sonic Pixel art.

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!

Hey you, rookie! Yes, I am talking to you!! Come over here? Relax! Just stick to me and everything will be fine. By the way, my name is James Varhuher, but you can call me Big J. I will bring you up to speed.