• 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 DerLasseHenrich · Jun 18, 2019 at 09:32 AM · rigidbody3dgravityhingejointfriction

Prevent rigidbody with hinge joint from slowing down

I created this model: alt text The log swings around its support. This support is the parent object of the log and has no Rigidbody and just consists of a mesh. The log has these components which are used for the swinging: alt text You may see that it doesn't use gravity, so I simulated gravity with this line of code:

 rigidbody.AddForce(direction * 9.81f);

"direction" is just the vector which points towards the stone path, so basically down

So here is my problem: The log is slowing down. It doesn't just swing there forever, instead its speed gets less and less, like if it's affected by friction. Its rigidbody already has angular drag set to zero, so I honestly don't know what causes this. If you have any idea, please let me know. Thanks!

logslowing.png (402.5 kB)
logcomponents.png (44.9 kB)
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
1
Best Answer

Answer by metalted · Jun 18, 2019 at 08:19 PM

Well its doing exactly what you tell it to do right? Aside from the changed gravity direction its the same as any other swinging log. The force will pull it towards the earth and at some point it will stay there. Just like a regular pendulum on earth. If you want it to keep swinging you should add some force to it, just like a swing set. You could of course also fake it. Just because a log swings with a "hinge joint" in the real world doesn't mean it has to do it in your game. You could also just rotate the log around its pivot point using a Mathf.Sin or a pingpong function. It will do exactly the same as you want it to do with the rigidbody, with less of the hassle of joints and rigidbodies.

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 DerLasseHenrich · Jun 18, 2019 at 08:22 PM 0
Share

Actually that's no bad idea to just fake it. I am gonna try with this one, thank you!

avatar image metalted DerLasseHenrich · Jun 18, 2019 at 08:27 PM 0
Share

Yeah rigidbodies and joints are really tricky. They can break, they can shift apart, fixed joint are not really fixed and can become loose under the weight. In most cases when I wanted to achieve an effect in my scenes, I would be stuck in a way how it works in the real world and try to copy that. But most of the times, I would resort to a simpler solution of just translation and rotation and I would get the same effect. But it always hard to determine if you really need rigidbodies or not.

avatar image DerLasseHenrich metalted · Jun 18, 2019 at 08:29 PM 0
Share

Exactly, I also had some hard times with joints in some of my other games. Sometimes you're better off without physics :D

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

172 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

Related Questions

A position locked hinge joint with drag and no gravity? 1 Answer

How can I drag an object with touch on X and Z axis without disrupting the gravity of the rigidbody? 0 Answers

Rigidbody with FreezeRotation on x,y,z enabled still rotates whenever in contact with colliders 0 Answers

How to have a sphere roll/be affected by friction 0 Answers

Faux Gravity help 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges