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 paulsk8 · Jan 01, 2014 at 11:15 AM · 2drotatemovesimplebike

newbie 2d simple sprite rotation

Hello everyone! I need to rotate a wheel, by it's center origin, to make my 2d car move.

I didn't found anything..

I did this, but it only pushes the wheel, and is not good

 rigidbody2D.velocity = new Vector2(move * 10, rigidbody2D.velocity.y);


Help me !

Also

   float rot = Input.GetAxis("Horizontal") * 20;
 
             transform.Rotate(0, 0, rot);

This will rotate the sprite, but it doesn't affect anything

Comment
Add comment · Show 1
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 reefwirrax · Jan 01, 2014 at 11:27 AM 0
Share

maybe torque:

https://www.google.fr/search?q=torque+unity&oq=torque+unity&aqs=chrome..69i57j0l5.1788j0j4&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8

the car will only move if there is traction on wheel, search for 3d car propulsion questions, there are many, it's probably the same

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by HappyMoo · Jan 01, 2014 at 12:26 PM

There is no WheelCollider for 2D. It's worth a shot to try a normal Circle collider, but if that doesn't work, you'll have to roll your own WheelCollider2D and there's no CircleCast in Physics2D like SphereCast in Physics, which makes it harder.

So, let's try Circle-Colliders:

  • Import the Physic Materials package

  • Put "Rubber" on your CircleColliders and "Wood" on your floor.


    float rot = Input.GetAxis("Horizontal") * speed; backTire.rigidbody2D.AddTorque(rot);

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 paulsk8 · Jan 01, 2014 at 12:30 PM 0
Share

That is 3D, i need 2D

avatar image paulsk8 · Jan 01, 2014 at 05:48 PM 0
Share

What adding rubber means?

avatar image HappyMoo · Jan 01, 2014 at 05:55 PM 0
Share

On every collider you have a material where you can assign your Physics$$anonymous$$aterials, but I just realized that you need Physics2D$$anonymous$$aterials... so you have to create them yourself:

In the Project, create "Physics2D $$anonymous$$aterial" and create one for your tire and one for your floor. Then give your tire material some bounciness, maybe 0.1 and test it out. Later you can play with the friction and bounciness to get the right feeling,

avatar image paulsk8 · Jan 02, 2014 at 09:08 AM 0
Share

I creted with friction like 10, bounce 1, just to see if there any diference, i've added to my sprite, but nothing, same movement.

avatar image HappyMoo · Jan 02, 2014 at 09:12 AM 0
Share

bounce only come into play if you fall/jump onto the material and friction... try 0 - it should be so slippery that you don't move anymore

Show more comments

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

20 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

Related Questions

2D Character grabing the wall 1 Answer

simple movement help 1 Answer

2D Movement Problems 2 Answers

Flipped objects Rotation issues 1 Answer

2D Animation does not start 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