• 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 cmk2901 · Jun 01, 2011 at 02:12 PM · rigidbodydrag

Smooth Rigidbody Drag around Objects

Hey guys,

I'm working on a game where there are several rigidbodies arranged in a playspace and the player can select one of the rigidbodies and drag it around. I've gotten this to work ok, but there are a few issues I'm having that I'm unsure how to resolve.

1) Is there any way to have the dragged object smoothly glide around the edges of obstacles? For example, if there is a row of objects in the way, I'd want the dragged object to stop at the edge of the objects, but then still move up and down, "gliding" against the edges of the objects. I've tried using MovePosition, but there is some interpenetration that occurs.

2) When the dragged object hits other rigidbodies in the area, it pushes these other rigidbodies out of the way. I don't think I can make the rigidbodies kinematic because I still need to apply gravity to them. Is there any way to make a rigidbody immovable by another rigidbody?

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
0

Answer by hellcats · Jun 01, 2011 at 03:24 PM

If you are effectively pausing the simulation when you are dragging your objects around, then you could make everything else kinematic while paused except the object you are dragging. Don't set Time.timeScale to 0 in this case and the simulation will continue to run while you drag the object around. You can drag it by applying a force (with increased drag on the object so it won't oscillate around the mouse), or by using a spring joint connected to a temporary kinematic object moved by the mouse (this kinematic object should not collide with anything).

If you aren't pausing the simulation, then your could just make the mass of the object you are dragging very very small in relation to everything else and it won't push them around by very much.

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

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Character Slowly sliding off platform 1 Answer

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

Dragging rigidbody with SpringJoint? 0 Answers

Dragging Planes doesn't work with iOs? 0 Answers

moving objects in like in amnesia 8 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