- Home /
Script error with turrets
var LookAtTarget:Transform;
var damp = 6.0;
function Update ()
{
if(LookAtTarget)
{
var rotate = Quaternion.LookRotation(LookAtTarget.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * damp);
{
//transform.LookAt(LookAtTarget);
}
The error: Assets/TurretBehaviour.js(13,2): UCE0001: ';' expected. Insert a semicolon at the end.
Hard to help when your code isn't formatted or complete.. The error says you are missing a semicolon... $$anonymous$$aybe you are, can't tell with snippet you provided. Is there more code? If not, where are your closing curly brackets? "}"
I reformatted your code and changed the tags. The code had odd escape characters in it, so please be sure you are pasting plain text in your submission. Also select the code and hit the little "binary" button to have it get marked up as code. The reformatted code looks like it has a stray opening brace.
Answer by RazorShockGames · Sep 10, 2012 at 09:08 PM
Okay lemme code it again and send you it in proper format
Answer by RazorShockGames · Sep 10, 2012 at 09:08 PM
The code I used is here: http://youtu.be/cyXV3dUU30w?t=5m8s
Answer by Ranger-Ori · Sep 10, 2012 at 07:56 PM
Well it seems you are new to programming at all as you fail to realize what's the error you encountered. (And this is the most common and basic error there is)
I suggest you go back to learning the basics of programming, whether it's C#/C++/Javascript or Java. There are plenty of tutorials over the internet. Good Luck!
Ins$$anonymous$$d of being a snob about it, why don't you be helpful? This isn't even an answer so why did you reply as such? And the error is misleading, it mentions a missing semicolon, in reality, it's because of missing curly braces.
I suggest you go back to learning the basics of etiquette, whether it's in writing or in speech, There are plenty of tutorials over the internet, Good luck!
So Jesse, did you find what the problem was? Cause I don't have a clue. Oh wait, he did post his problem, he actually copied it, and posted it with his question, so stop being such a prig.
Answer by RazorShockGames · Sep 10, 2012 at 09:08 PM
Why is your comment coming though and not mine?
Answer by Jessespike · Sep 10, 2012 at 09:15 PM
The error is misleading, you need closing curly braces.
public var LookAtTarget:Transform;
var damp = 6.0;
function Update ()
{
if(LookAtTarget)
{
var rotate = Quaternion.LookRotation(LookAtTarget.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * damp);
}
//{
// transform.LookAt(LookAtTarget);
//}
}