Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Wafflemaster · Dec 05, 2012 at 10:13 PM · noobvar

Why does my var speed say it is wrong

Title says it all when i typed the code it says unexpected char: 0xFEFF. (BCE0044) i know i know i sound like a whining noob put i wanted to learn gaming development and now that i have it and my code is not working it's hard for me 2 continue. Here is my code i put down. #pragma strict

 function Start () {
 
 }
 
 var speed = 3.0;
 var rotateSpeed = 3.0;
 
 function Update ()
 {
 
     var controller : CharacterController = GetComponent(CharacterControll­er);
     //Rotate around y - axis
     transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
     
     //Move forward / backward
     var forward = transform.TransformDirection(V­ector3.forward);
     var curSpeed = speed * Input.GetAxis ("Vertical");
     controller.SimpleMove(forward * curSpeed);
 }
 
  @script RequireComponent(CharacterController)

Please if u know whats wrong tell me

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Dexter.Unity · Dec 05, 2012 at 10:25 PM

You simple place this script ON the character you want to move. I think it should work.

A few lines where wrong, here you can read how to move an object around:

http://docs.unity3d.com/Documentation/ScriptReference/Transform.Translate.html

 var speed = 3.0;
 var rotateSpeed = 3.0;
 
 function Update ()
 {
     //Rotate around y - axis
     transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
 
     //Move forward / backward
     transform.Translate(Vector3 (0,0,Input.GetAxis ("Vertical")) * speed * Time.deltaTime);
 }
Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Dexter.Unity · Dec 05, 2012 at 10:56 PM 0
Share

Please tell me if it worked! :)

avatar image Bunny83 · Dec 06, 2012 at 12:05 AM 0
Share

Your script has actually nothing to do with the script in question. He uses the CharacterController component. Your script doesn't perform collision detection.

avatar image Wafflemaster · Dec 06, 2012 at 12:11 AM 0
Share

Dexter.Unity i have one thing to say.....I LOVE YOU $$anonymous$$AN!!!!! (no homo) THAN$$anonymous$$S A BUNCH IT WOR$$anonymous$$S!!!!!! :D

avatar image Wafflemaster · Dec 06, 2012 at 12:43 AM 0
Share

hmmmmm that is weird....when i move it for a while it'll start to bounce and the sphere wont move . What is happening now D:

avatar image Dexter.Unity · Dec 07, 2012 at 08:41 AM 0
Share

Are you moving the sphere as a character that's experiencing gravity?

avatar image
0

Answer by Bunny83 · Dec 06, 2012 at 12:11 AM

There's nothing (visible) wrong with your script. The character 0xFEFF is a special character at the beginning of a unicode file (it's the byte-order-mark).

Try to change the encoding of your file. Check the save dialog of your texteditor for the encoding format. This is actually the same question.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Wafflemaster · Dec 06, 2012 at 12:16 AM 0
Share

it ok it works tho i'll save that^ on my notes about this, Bunny83. That is really good to know later on ^.^

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

How do you code in unity 3.5 and what if any programs would you need 2 Answers

Having some issues with firing a "projectile" 1 Answer

How do I make a respawn system? 1 Answer

I made a better shader how do i fix[add _Shadow Strength]help???>Sorry that im asking for to much 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges