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 timrox99 · Oct 02, 2014 at 10:17 AM · errortransformtoken

I'm trying to teleport an object. But keep failing.

So I am really newbie at unity at the moment and I do believe this script would work if it wasn't written by me. I am trying to teleport my First person controller to x=10 y=3 z=-8. I have three errors that conclude of:

< ';' expected. Insert a semicolon. (when there is one)>

My script:

 #pragma strict
 
 function OnTriggerEnter (info : Collider){
 
     if (info.tag == "Player"){
         transform.position=10, 3, -8;
     }
 }

I understand that this error is just because I do not know how to JavaScript yet. Any help would be greatly appreciated Cheers.

Comment
Add comment · Show 1
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 timrox99 · Oct 02, 2014 at 09:54 AM 0
Share

I added other errors, bur for some reason they're not there. The errors:

unexpected token: ,.

unexpected token: 3.

2 Replies

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

Answer by Xitech_ · Oct 02, 2014 at 12:39 PM

You forgot the bracelets. And Vector3 This is the finished code:

  transform.position= Vector3 (10, 3, -8);


In the future. You can check Unity's Scripting API. See this one for transform.position

http://docs.unity3d.com/ScriptReference/Transform-position.html

Comment
Add comment · Show 2 · 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 timrox99 · Oct 03, 2014 at 01:42 AM 0
Share

Thanks heaps man.

avatar image Xitech_ · Oct 03, 2014 at 06:39 AM 0
Share

Please accept the answer if it helped you.

avatar image
1

Answer by haim96 · Oct 02, 2014 at 12:55 PM

i think it's because teleport haven't invented yet... :D

beside that, the code you might need is:

transform.position= new Vector3 (10, 3, -8);

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 dmg0600 · Oct 02, 2014 at 01:37 PM 0
Share

Being Javascript you don't use new, just Vector3(10, 3, -8);

avatar image Xitech_ · Oct 02, 2014 at 01:51 PM 0
Share

He is using JS. So new is not needed :)

avatar image Xitech_ · Oct 02, 2014 at 02:10 PM 0
Share

I dont know who downvoted my answer but thats not a good way to say thank you.. Lol

avatar image haim96 · Oct 02, 2014 at 06:12 PM 0
Share

didn't note the java thing... hope it working now any way! i up voted you so the -1 is gone now...

avatar image timrox99 · Oct 03, 2014 at 01:42 AM 0
Share

Thanks for the help dude

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Unexpected Token 3 Answers

Need help! Enemy follows player with its head! 2 Answers

Contunuing from old scene 1 Answer

BCE0005: Unknown identifier: 'spriteRenderer'. 2 Answers


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