• 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 SolidiusJake · 4 days ago · 2d-platformerscripting beginner2d-physics

How to implement sonic style Rolling/Spindash,How would I implement a rolling feature for the player in unity?

I'm a fairly new to unity, but I'm trying to learn more about the program. To this end, I'm attempting to create a sonic clone, but I'm really stumped on the rolling mechanic. The only way I know how to implement something like this is to make it so the player changes from a box collider to a circle collider, but I don't know if that's even possible. I tried to look up some tutorials to see if I could find something on how to do it, but haven't found anything. So I thought I'd make a post here to see if anyone could help. ,I'm somewhat new to unity, but in an attempt to expand my knowledge within the program I wanted to make a sonic clone. Something that's got me stumped is the spindash/rolling mechanic. I don't know how I would implement something like this within the game. The only way I can think to do it is to change the player's collider from a box collider to a circle collider, but I'm not sure how I would go about doing that, or if it's even possible. I tried looking up tutorials on how to do it, but haven't been able to find anything. I was hoping someone could help me here.

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

Answer by ZY_bros · 3 days ago

first add a box collider and a circle collider, disable the circle collider then use gameObject.GetComponent<>(BoxCollider).enabled = false and gameObject.GetComponent<>(CircleCollider).enabled = true on your player

Comment
Add comment · Show 3 · 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 SolidiusJake · 3 days ago 0
Share

it took me a bit, but I was able to figure out how to get it to work (the main struggle was wrestling with input system and figuring out how to add buttons with the input manager). The circle collider worked at first, but I noticed it was just... sliding down the halfpipe I made instead of rolling down. So I turned on rotation for the rigidbody, and that seemed to help, but not very much. I have a circle in the scene along with the player that rolls around the halfpipe for testing this mechanic, and the player moves very slowly down the halfpipe compared to the circle. Am I somehow missing something?

avatar image ZY_bros · 2 days ago 0
Share

does the player also have a circle collider? also could you upload a video showing the problem

avatar image SolidiusJake ZY_bros · yesterday 0
Share

The player also has a circle collider, but it rolls much slower than I'd like, and I'm not sure how to make it go faster. The only thing I can think of is using apply force instead of velocity to move the player. Also I apologize for the extremely lackluster graphics. I wanted to get as much of the game working as possible before doing any pixel art. Here's a link to a video of what's going on: https://youtu.be/uz7e4RRQ_RI

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

169 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

Related Questions

Handling friction in scripts for a 2D platformer 1 Answer

[2D] Add force to all colliders within a certain radius 1 Answer

RotateAround using physics 1 Answer

2D Collisions Not Working 2 Answers

Death Counter dont work when changing scenes 2 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