Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

A script that doesn't allow moving objects to go through non-moving objects?

$
0
0
I have a player, a zombie, and walls. The player does not go through walls or the zombie. The zombie goes through walls. Movement script: var target : Transform; var moveSpeed = 20; var rotationSpeed = 5; var myTransform : Transform; function Awake() { myTransform = transform; } function Start() { target = GameObject.FindWithTag("Player").transform; } function Update () { myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime); myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime; } I no longer care what the script is, as long as it works. Can someone please respond?

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>