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 /
avatar image
0
Question by CoreApp2 · Mar 17, 2016 at 08:49 AM · speedobjectsmovetouchscreenslide

How can i make an object (a cube) change the surface or plan of the game?

Hello everyone, i have a problem and hope you help me please

Ich have a cube or a sphere o. The sphere moves only between the surfaces (1), (2), (3) , (4) (over surface 1, under surface 2, over surface 3 and under surface 4). At the start the cube has already a speed. That means it moves from the left to the right automatically, and when the user touch the screen, the object slide (or jump) to the other surface, from (1) to (2), then (2) to (3), (3) to (4) and so on, and only between them and not over(surface 2 and 4)

                                  (2)
                      =================
                                                                                 (4)
      o    (1)                                                                =================
  =============                                                    
                                              (3)
                                        =====================================

Please help me this to realize that

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
2

Answer by Le-Pampelmuse · Mar 17, 2016 at 09:27 AM

Unity Answers will not help you create basic games, it is meant for serious questions about problems with Unity. If you are looking for tutorials, Google is your best choice ;)

Please make sure your questions are appropriate for Unity Answers before asking them. Check the FAQ.

There is confusion among many moderators and they publish everything sadly.

If you are following tutorials and have trouble to understand them, you should watch the beginner tutorials made by Unity in the Learn Section. alt text

Comment
Add comment · Show 6 · 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 CoreApp2 · Mar 19, 2016 at 09:18 AM 0
Share

Hi, If a moderator publishes a question, it means that the question is worthy or has the requirements to be published. If you have no idea about the issue, it is not a problem. You do not need to write something, but if it is not the case, then we(the community and i) would be very happy that you share it with us. Thank you!

avatar image Le-Pampelmuse CoreApp2 · Mar 19, 2016 at 11:37 AM 2
Share

That's not correct. If I publish a question that is pure spam (which happens regularly during spambot attacks) , is it worthy of being on UA? Does it meet the required standards? I dont think so.

Everyone becomes a moderator at 1000 reputation, it is not a choice. It's a common problem (with almost any community-moderated forum) that many moderators binge-publish questions from the mod queue because they want to be friendly or simply and seriously don't know how to handle the tasks of moderating.

I didn't mean to sound rude or condescending in any way, if I did to you, I apologize.

Taking on to your Question, what exactly do you want to achieve? Correct me if I'm wrong:

  • A sidescrolling platformer mobile game

  • Player has to jump to reach the next platform, if he jumps in between, he loses/dies

  • Player sticks to the upper part of low platforms, and to the bottom part of high platforms.

  • Done

What I would suggest for the issue of top or bottom platforms (keep in $$anonymous$$d this is a subjective idea):

Have a prefab rectangle for the platforms. Add a child box collider to each the "good" side and the "bad" side, tag those colliders accordingly, good and bad.

Now use built-in collider functions like OnCollisionEnter2D to check when the player collider is touching another collider (meaning a platform). Check via the tags if it is a good touch, the player keeps moving, if it is a bad touch (lol) the player loses a life and restarts at the beginning or a checkpoint based on your game.

I guess this is your biggest obstacle, how to implement this functionality.

Feel free to ask if something is not understandable.

avatar image CoreApp2 Le-Pampelmuse · Mar 19, 2016 at 02:05 PM 0
Share

Thanks for the reply. i try to improve my knowledges, i want to make something like this ninja game . he runs under or above a surface. the problem that i have is when i jump to the surface above. he doesnt stay on the surface above. He falls downalt text

y-ninja0.jpg (48.6 kB)
Show more comments
avatar image CoreApp2 · Mar 23, 2016 at 10:04 PM 0
Share

Ok thats is what i currently try to do

 void Update()
     {
         if (Physics.Raycast(transform.position, -Vector3.up, raycastDistance))
         { 
             // I check, if the object is on the ground or bottom
             isGrounded = true;
             airJumpCnt = maxJumpCnt;
         }
         else
         {
             isGrounded = false;
         }
         
         // i give the object a speed value if it is the case
         if (isGrounded)
             {
                 rb.velocity = Vector3.right * xSpeedLev; // oder 5
                 //countEins = 0;
             }
         $$anonymous$$ouseInput();
 }
 
 private void $$anonymous$$ouseInput()
     {
         if (Input.Get$$anonymous$$ouseButtonDown(0))
         {
             //countEins++; // how many times i hit the top or the bottom
             selObj = EventSystem.current.currentSelectedGameObject;
                 if (selObj == null || selObj.gameObject.tag != "UIButton" || selObj.gameObject.tag != "Finish")
                 {
                     isGrounded = false;
                     //try to jump with 45° up to the top and then with 45° down to the bottom
                     rb.velocity = new Vector3(xSpeed, normalJumpForce, 0f);
                 }
             }
     }
avatar image Le-Pampelmuse CoreApp2 · Apr 04, 2016 at 11:03 PM 2
Share

Sorry for reacting so late I didn't get a notification about it.

DId you post this intentionally as an answer? Is this your solution?

Edit: I just converted your answer to a comment on my Question because I feel like you were asking for guidance with your script attempt and not giving a final solution.

Feel free to ask what you are having problems with. Don't leave your Questions open and comments unanswered ;)

avatar image
0

Answer by Roddeck · Mar 19, 2016 at 03:15 PM

Well, you could write something that ignores colliders if ninja is below platform and enables them if he is above.

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 Le-Pampelmuse · Mar 21, 2016 at 01:37 PM 2
Share

That won't do much because then the game would be only about moving on top of platforms, not both. Please read Q's carefully before answering ;)

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

6 People are following this question.

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

Related Questions

İ want my object move to target object Within 3 seconds how to make it ? 0 Answers

[yes / no question] Move objects WITH the terrain 1 Answer

How to make multiple objects with the same script work independently? 0 Answers

How to keep moving an object only with its speed? 0 Answers

How to increase and decrease speed gradually? 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