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 Tocs · Apr 25, 2013 at 04:30 PM · physicsinputjointconfigurablejoint

Using a ConfigurableJoint to move an object to a postion and rotation.

I have input from various motion controls which essentially give me a position and rotation. I found using kinetic based rigid bodies to be disappointing, they had lots of tunneling and the controlled object could punch through anything it encountered. I'd much rather use forces to guide an object through space to orient itself in line with the inputs.

I thought the configurable joint would be the appropriate thing to use, it hooks into PhysX and uses springs and the physics solver. And would presumably be better than me hand rolling forces and throwing them at PhysX. When I hand roll tracking forces, it tracks through space just fine, but if I push against objects the object begins to jitter.

So I attempted to first, just move towards the position and ignore rotation.

If I add a ConfigurableJoint and set its x,y,z motion to Limited, and change all of its x/y/z Drives to Position based with a damper of 10 and a spring of 100. Changing "targetPosition" makes absolutely nothing move.

 Constraint = gameObject.AddComponent<ConfigurableJoint>();
 
 Constraint.xMotion = ConfigurableJointMotion.Limited;
 Constraint.yMotion = ConfigurableJointMotion.Limited;
 Constraint.zMotion = ConfigurableJointMotion.Limited;
 
 Constraint.angularXMotion = ConfigurableJointMotion.Locked;
 Constraint.angularYMotion = ConfigurableJointMotion.Locked;
 Constraint.angularZMotion = ConfigurableJointMotion.Locked;
 
 JointDrive drive = new JointDrive();
 drive.mode = JointDriveMode.Position;
 drive.positionDamper = 10;
 drive.positionSpring = 100;
 
 Constraint.xDrive = drive;
 Constraint.yDrive = drive;
 Constraint.zDrive = drive;

The documentation is stupidly light on this class, what do I do?

Comment
Add comment · Show 4
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 unityuser94 · Jun 03, 2013 at 01:19 PM 0
Share

I have been having similar trouble, I am not sure what I did different, but I have been able to get it to move. Also, it appears that the target position variable acts really odd. Ins$$anonymous$$d of setting the position it deter$$anonymous$$es how far in what direction the joined object moves towards. If you ever figure it out it would be awesome if you posted your solution here.

avatar image Tocs · Jun 03, 2013 at 01:24 PM 0
Share

Hi unityuser94, Not to pull one of these on you ... http://xkcd.com/979/

I recently revisited this problem with no luck. However in the mean time I created a function that applys a force and torque every "FixedUpdate ()" that moves an object to a position and rotation, however because it's not a spring based solution it can have dubious results when put put under stress...

Anyhow its pasted over here. http://pastie.org/8000460

If I ever do figure out how to get a Configurable Joint to behave as the documentation advertises, I'll be sure to post it.

avatar image unityuser94 · Jun 03, 2013 at 01:40 PM 0
Share

O_O that was fast, and the xkcd totally describes the situation here, except it seems we have a solution. Thanks for the code, I didn't expect a response with a solution so fast. If I ever find a configurable joint solution Ill post it here as well, though from the tests i did, it doesn't look like they are going to want to do that.

avatar image Zergling103 · Apr 05, 2014 at 06:07 AM 0
Share

The guys at PhysX came up with the worst possible design imaginable. Figuring out anchor positions and rest rotations was enough of a headache... Target Position seems to be a completely lost cause - utterly broken, utterly useless. The only cure is to have your rigidbody joined to a kinematic rigidbody with a target position of 0,0,0, and then set the world position of it. -cries-

0 Replies

· Add your reply
  • Sort: 

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

14 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

Related Questions

Configurable Joint referencing from scrip 1 Answer

OnJointBreak 1 Answer

Calling OnJointBreak on Connected body 1 Answer

How to apply joint's inverse forces to another body 1 Answer

Joint system scale problems 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