• 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
1
Question by VRlunatic · Oct 05, 2019 at 05:53 AM · physics2dkinematichingejoint2d

Hinge Joint 2D not working when Rigidbody is Kinematic

I'm making a 2D pinball game in which the flippers are animated with a Rigidbody 2D and Hinge Joint 2D components. All works fine when the Rigidbody is set to Dynamic, but when I change it to Kinematic, the flipper doesn't respond to input. It doesn't rotate.

I think it's better if the flippers were Kinematic as there's no need for them to calculate physics. All they need to do is provide something for the ball to bounce off of, and I think they don't need to be included in the Physics 2D calculations.

What could I be missing that's preventing the flippers from rotating when I change them to Kinematic? Any help is welcome!

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
0

Answer by VRlunatic · Oct 06, 2019 at 11:18 AM

Also, maybe this matters: I'm using the motor function to move the flippers. Maybe they only work when the hinge joint is dynamic. How to rotate the flippers kinematically? Thanks.

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 prabhjeets · Oct 11, 2019 at 05:19 AM

I have almost the exact same problem and am unable to move the object by modifying the motor speed in script. Been banging my head against Google searches for a couple of days now with no luck. Below is my FixedUpdate method. I can see the speed being set on the motor of the hinge in the debug statement but object does not move.

     void FixedUpdate()
     {
         
         if (isKeyPress)
         {
             myMotor.motorSpeed = 1000;
             myHinge.motor = this.myMotor;
             myHinge.useMotor = true;
             Debug.Log("Motor Speed: " + myHinge.motor.motorSpeed);
         }
         else
         {
             myMotor.motorSpeed = -1000;
             myHinge.motor = myMotor;
         }
         
     }
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 VRlunatic · Oct 11, 2019 at 05:35 AM 0
Share

That's because you can only use the motor function when the rigidbody is set to dynamic. The motor function has to use physics. When you set the rigidbody to kinematic (as I want it because it's more efficient) then you cannot use the motor function for rotation but have to do it a different way, such as with transform.rotate or with a tween. I'm using a tween from DOTween which works well, as I described above. The only problem is that the ball is hit too hard, as you cannot specify the force when using kinetic simulation. I hope someone offers an answer to this. I am thinking I have to somehow dampen the physics material, I'll check out the settings when I get home.

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

187 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

Related Questions

Is there any way to emulate centrifugal force? 1 Answer

Unable to AddForce on a game object containing a RigidBody2D and a HingeJoint2D? 1 Answer

2d gameobjects stuttering 0 Answers

Hit from kinematic rigidbody2d 1 Answer

Hingejoint2d's connected body unaffected by joint, spinning wildly (video) 0 Answers

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