Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 daviddickball · Nov 28, 2015 at 12:46 PM · physicsrigidbodydragcubefriction

Move rigidbody cube without it tumbling

I've got a cube as a player, that I want to move around on top of a larger cube. The cube has a rigidbody as I want it to tumble and fall off the edge if you get too close. I'm using AddForce() to move the cube around, but for some reason it tumbles as it moves, and I don't want that to happen. I want it to slide effortlessly over the surface.

I don't want to constrain the axis, because I want it to tumble and fall. So how else can I stop it from tubling, is this because my drag is too high? I don't want the drag too high or it will be too slippery.

The stats are:

Mass: 20

Drag: 1

Angular drag: 0.1

Here's how I move the cube forward:

 GetComponent.<Rigidbody>().AddRelativeForce (Vector3.forward * 20, ForceMode.Impulse);

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
1

Answer by melazzeh · Jan 05, 2021 at 08:23 AM

Freezing rotation on X, Y and Z will do the trick. No code required.

Comment
Add comment · 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
0

Answer by beppim · Nov 28, 2015 at 02:29 PM

Five solutions :)

You can try by changing the physics material of the colliders, so it feels not just "less" drag, but different. In the standard assets there are some examples, maybe "metal" could be good for you. With P.M. you can differentiate between dynamic and static friction.

The second idea that came into my mind is to check that the force to move the cube is applied ON THE BOTTOM of the cube (actually applied force must be below the center of mass, so below 0.5 of the height), so that it should not rotate while pushing. That is the cleanest soution imho.

One more solution: apply a huge angular drag.

One idea also could be to put a fixed collider on top of it, as a sort of invisible ceiling, that avoids the cube to rotate.

Otherwise, there's no real solution to defeat physics when you want and make them present when you want: you can simply move the cube using transform.Translate(), so you won't apply a real force and it won't use physics until it will fall down.

Comment
Add comment · Show 5 · 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 daviddickball · Nov 28, 2015 at 07:55 PM 0
Share

Hmm, I could use Transform.Translate() but won't that mess with the physics of the rigidbody? I've been told not to use Translate on rigidbodies.

avatar image beppim daviddickball · Nov 30, 2015 at 01:43 PM 0
Share

I believe that there's no problem in using translate on rigidbodies. Of course, you're applying a sort of "magic" movement and therefore the physics won't be realistic (for example, the movement will stop immediately, without inertia), but that won't create real problems, besides a slightly unrealistic effect. You should not use translate on rigidbodies if you don't want physics to be bypassed.

avatar image daviddickball · Nov 28, 2015 at 08:07 PM 0
Share

I like your idea of applying the force at the bottom of the object - that makes sense! Although I've no idea how to apply relative force at a specific position! I seem to have to choose between using AddRelativeForce() or AddForceAtPosition() !!

avatar image beppim daviddickball · Nov 30, 2015 at 01:40 PM 0
Share

The force is applied to the center of mass of the collider (not of the object).

http://docs.unity3d.com/ScriptReference/Rigidbody-centerOf$$anonymous$$ass.html

You can edit its position, if you don't it will be calculated.

avatar image daviddickball beppim · Nov 30, 2015 at 04:46 PM 0
Share

Ooh, this is interesting, I didn't realise I could do this. I'll try it tonight and let you know!

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

40 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

Related Questions

How to stop jitter on rigidbody? 0 Answers

[SOLVED] Ball rolling around a planet bounces off? 2 Answers

Mass effects terminal velocity 1 Answer

Applying Drag To A Specific Point On A GameObject? 0 Answers

Toppling a group of cubes like the intelligent cube PSX game 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