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 redscaledone · Feb 13, 2014 at 09:04 PM · javascriptmovementhorizontalbce0077

[Andorid; 2D; acceleration; Movment] Assets/Movments.js(7,38): BCE0077: It is not possible to invoke an expression of type 'UnityEngine.Vector3'.

Ok this is my second attemp in writting this :) .. First of I am completly new.. and I want to creat my first Andorid game.

I startet with a couple of tutorials and even managed to make some small tests run on my phone but now I am trying something I never did bevor, I tried to do it myself but I get one error after another.. I am really desperate for every little help I can get.

First of I want my Player (A Ball) to move right when you tilt the Phone to the right side. Left when you till it to the left side. And Jump when you shake it and or touch it (The screen)

Prohblem is I don't even get to the point where it starts moving at all.. This is my first try with sensors and just the simple movments are making me itchy. I would really love if somone could help me a bit or at least tell me if my thinking is totally wrong or not.

This here is my Code:

 #pragma strict
 
 var rotationSpeed = 100;
 
 function Update () 
 {
     var rotation : float = Input.acceleration ("Horizontal") * rotationSpeed;
     rotation *= Time.deltaTime;
     rigidbody.AddRelativeTorque (Vector3.zero * rotation);
 }

well it works for keyinput controlls if I would change a segment but I have no Idea about acceleration..

Simply I want the ball to go faster the more I tild the Phone.. What is wrong with my Thinking?

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

Answer by Graham-Dunnett · Feb 13, 2014 at 09:30 PM

Input.acceleration is a Vector3. It's not a function, and doesn't take arguments.

Comment
Add comment · 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
0

Answer by redscaledone · Feb 14, 2014 at 04:23 PM

Thanks for the info I guess it is completlly wrong then.. Could somone give me a little help here? Only movment on the X Axis would be nice

so far I tried it with this here.

 function Update () {
     var dir : Vector3 = Vector3.zero;
     dir.x = -Input.acceleration.y*.5;
     transform.position.x += dir.x;
 }
Comment
Add comment · 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

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

19 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

I am trying to make a movement script for my main camera but it isnt working! 2 Answers

Slowing Down When Sliding Across Walls 2 Answers

Horizontal axis not working after animation 1 Answer

4 Direction Movement Problem 1 Answer

(2d in 3d) Movement relative to camera using JS 0 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