Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
This question was closed Oct 27, 2015 at 03:06 PM by shotofop for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by shotofop · Oct 22, 2015 at 07:37 PM · c#unity 5movementplayer movement

help with player movement

how can i make my ball when i click a mouse button to go up and move left and when i click a mouse button again to go down and continue to move right? I tried whit gravity but it is not that good for controlling the ball .I use c#. alt text

img.png (9.0 kB)
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

1 Reply

  • Sort: 
avatar image
1
Best Answer

Answer by Statement · Oct 22, 2015 at 08:22 PM

Well, one way is to set the position manually.
Judging from your picture it looks like the ball is just following a rail.

  • Example Project

  • BallMotion.cs

Pressing mouse button changes rail from top to bottom and vice versa.
Your picture and your description doesn't add up. I wrote the example based on your written description so the ball goes left and right in addition to up and down. I made a revision which only goes right.

  • Ballmotion.cs (Moves only Right)

Comment
Add comment · Show 7 · 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 shotofop · Oct 23, 2015 at 02:05 PM 0
Share

@Statement The script works but when the game starts the ball goes in the bottom rail and when it moves just right on bottom and top rail it jiggles up and down

avatar image Statement shotofop · Oct 23, 2015 at 10:55 PM 0
Share

Did you try my project?

It may be that you have other components influencing the behaviour, like a non-kinematic rigidbody which react to physics and/or gravity.

avatar image shotofop Statement · Oct 24, 2015 at 03:19 PM 0
Share

@Statement It works you have put the rails as a child object i haven't. But now i cant make the ball fall when it goes over holes in the rails.

Show more comments
avatar image shotofop · Oct 25, 2015 at 01:21 PM 0
Share

@Statement The problem with gravity is that i need to increase it a lot to get fast vertical speed but it gets buggy when i set gravity over 200 the ball starts to go in the rails and i also want to make the horizontal speed to get faster but to go faster horizontally i need faster vertical speed and gravity gets buggy .So i though that there is another way to set speed but i m not good with program$$anonymous$$g so i didn't know how to do it.

avatar image Statement shotofop · Oct 25, 2015 at 01:48 PM 0
Share

Sounds like your game scale is all wacky. 1 unit should be 1 meter. A gravity of 200 is like, 200m/s^2 which is ridiculously high. If your rails are thin or simple mesh colliders, you'll experience tunneling problems (teleporting to other side of collider). You could also try to enable continous collision detection on the ball. Anyway, I suggest you post a new question with a specific question on how to solve your gravity problem if you want to do gravity. Include what you've tried, what doesn't work, what your desired outcome would be etc.

avatar image shotofop Statement · Oct 25, 2015 at 02:21 PM 0
Share

@Statement Ok thank you for your help.

Follow this Question

Answers Answers and Comments

38 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 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

Photon Player Mover Failure 1 Answer

Tracking transform position 1 Answer

Help with Vector3.Distance 0 Answers

Need Help With Having Player look at an object while stationary. 0 Answers

how to make forward relative to the view of the camera 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