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 tenthplanet0 · Apr 03, 2013 at 06:24 AM · movementmobilespawntiltround

player move based on tilt of the mobile device... movement of the spawned item in rounded way like subway surfer

hiiii developers,

I want the help in two things

1) I want to move my player based on the tilt of mobile device. So how can I detect whether the device is tilted right, left, straight(normal), front and back?

2) another thing is I want the movement of my front spawned path or simple path in rounded fashion. So, how can I achieve that? subway surfer is the example like what I want to achieve...

I have one more question... in temple run 2 the character is jumping and when he is touching the rope then he is moving along with the rope and also on mobile tilt rotating right and left. So, how can we achieve that?

Comment
Add comment · Show 2
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 tenthplanet0 · Apr 16, 2013 at 12:00 PM 0
Share

no one have the solution for my answer??? I thought this is the place of the awesome developers and I can get my solution.... but in vain....

avatar image Graham-Dunnett ♦♦ · Apr 16, 2013 at 03:25 PM 0
Share

Well, we kinda help people with real problems, and not those too lazy to look for their own answers. I'll be kind and help you on this occasion.

2 Replies

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

Answer by Graham-Dunnett · Apr 16, 2013 at 03:35 PM

  1. Sounds like you need to use a Gyroscope. In Unity use `Input.gyro` to get access to the device's gyroscope.

  2. Use splines to define the curved paths. Now in your code "forward" means to move in the direction of the spline, and left and right means tangentially to the spline.

  3. If the rope is a spline, then you can compute the shortest distance of the player to the spline. This distance will be perpendicular to the spline, so in reality you're also computing where on the spline this shortest distance reaches. Then, when your player jumps, you can compute how close to the spline he gets. If you are within some distance, then in your code your player can travel along the rope.

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 tenthplanet0 · May 02, 2013 at 06:35 AM 0
Share

Graham thanks, your comment and answer really helped me and because of that I increased my capacity of thinking and logic furthermore. I am hungry of program$$anonymous$$g and you helped me to have it.... Thanks buddy

avatar image
0

Answer by Tawakal125 · Dec 30, 2019 at 10:52 AM

tenthplanet0

void Start() { rb = GetComponent(); }

void FixedUpdate() {

    //  horizontal movement code through device rotation

           var movement = new Vector3(Input.acceleration.normalized.x, 0.0f, 0.0f);
           rb.velocity = movement * speed;
     

}

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

13 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

Related Questions

Using Mathf.Clamp with Accelerometer to control movement speed has slow response time, how can I smooth it out? 0 Answers

Simulate keyboard buttons to use Input.GetAxis ("Horizontal") 2 Answers

The game object penetrates the collision body when moving too fast 1 Answer

How to make responsive Touch inputs? 1 Answer

Problem in player movement using accelerometer input 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