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 console_motion_miracles · Jan 29, 2021 at 11:16 AM · unity 5controllerrectangle

How would i go about making a controller that works like this miniclip game

Hey so im trying to recreate a controller like this miniclip game >> https://www.miniclip.com/games/bloxorz/en/#privacy-settings

how would i go about making something like this. Currently what im trying to do is having a rectangle a parent of a pivot and i move it around depending on where the user swipes. So far i managed to get it working to fall and rise up again but when its flat on the ground and you try to move it sideways it gets really complicated to code. I feel like i might be doing it in a wrong way hence why its getting complicated.

Any help on this ?

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

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

Answer by jackmw94 · Jan 29, 2021 at 04:13 PM

If I were you, I do this using a separate move-helper gameobject. When you move in a direction you place this move-helper at the point on the ground along the edge over which you're turning with its forward vector in the direction you're moving and up vector in the global up direction. Then parent your block to it, rotate the helper parent along its X-axis from 0 to 90 degrees before unparenting it again to finish the move.

Here is an example of this process from this editor:

Step 1: https://ibb.co/NpPZM9G
Block and move helper are unparented.

Step 2: https://ibb.co/tqZYbs4
Place move helper along movement edge, rotate to point in direction of movement with up as global up.

Step 3: https://ibb.co/tYC6H12
Set your blocks parent to be the move helper.

Step 4: https://ibb.co/xsKSBgj
Rotate your helper around its x axis from 0-90. Since we rotated it so that forward looks in the direction we're moving and up is the global up before we parented it, this should be the same for any movement direction.

Step 5: https://ibb.co/LnQ8xxK
Unparent your block to finish



There are still some complications such as where to place the move helper. When you make a move, you should still be storing your block's position(s) on the grid so that at any point you know the position of the ground is around the block and you know when it's fallen off the edge, stepped on a switch, etc. I say positions because when it's on its side it will take up 2 cells. If you haven't used it so far, look into unity's gizmos (https://docs.unity3d.com/ScriptReference/Gizmos.html) to maintain visual in-scene debugging information! It's so much more useful to be able to look in the scene and see some coloured cubes showing where you might place your move helper than logging various vectors to the console.

Hope this helps, let me know if you have any problems :)

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 jackmw94 · Feb 01, 2021 at 11:04 AM 0
Share

@console_motion_miracles How are you getting on with this? If you've solved this problem using this answer, would you $$anonymous$$d marking it as accepted? Thanks!

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

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

Android controller 0 Answers

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Is it possible to access the speaker in the DualShock 4 controller without the PS4 kit? 1 Answer

How to change float animator parameters on an NPC object? 0 Answers

MobileSingleStickControl is not what I expected. 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