Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 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 /
avatar image
1
Question by Speedy41 · Mar 03, 2011 at 08:49 AM · physicsforcefreezefallingmotion

How To Freeze An Object Motion?

I'm trying to stop an object motion by applying force on it. For example, how could we freeze a free falling object in the air just by applying some force on it that would effectively set its velocity to zero?

Setting the velocity to zero manually would work fine if we decrease the FixedTimestep variable to a very low value, otherwise, the object would still fall slowly.

I've tried to apply a force equal to -velocity * mass, but the object still falls slowly.

Could anybody tell me how to do this just by applying some forces? (I mean without using Rigidbody's FreezePosition or IsKinematic variable)

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

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by robert 4 · Mar 03, 2011 at 09:49 AM

in components - physics add rigidbody check the box freeze rotation

  rigidbody.isKinematic = true; // through scripting kinematic means no physics      will    apply at that time 

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 Speedy41 · Mar 05, 2011 at 06:14 AM 0
Share

that would work but it's not the answer to my question. But thanks anyway.

avatar image
1

Answer by demize2010 · Jun 14, 2011 at 09:42 AM

Pretty easy one, just set the velocity of the rigid body to null.

 var forceToAdd : Vector3 = Vector3(0,0,0);
 
 rigidbody.velocity = forceToAdd;
Comment
Add comment · Show 2 · 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 musicm122 · Jan 20, 2014 at 03:11 AM 0
Share

There is a built in Vector.zero so you don't have to instantiate one. see http://docs.unity3d.com/Documentation/ScriptReference/Vector3-zero.html

avatar image danek.coco · Jun 09, 2016 at 01:58 AM 0
Share

This is definitely the best way to achieve this (well, as long as your incorporate musicm122's comment).

avatar image
0

Answer by Speedy41 · Mar 05, 2011 at 06:23 AM

Looks like it can't be done. Since setting the velocity to zero doesn't freeze the object, I think that the gravitational force is applied by the physics engine after FixedUpdate() returns.

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 hawken-2 · Jun 14, 2011 at 08:52 AM 0
Share

yeah I'm co$$anonymous$$g up blank with this too.

Would I would suggest is making an if clause or boolean before your addForce loops in FixedUpdate, that way you can stop force being added if certain conditions are met.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Force in Circular Motion 1 Answer

add force to object that has 2 different rigid bodies 0 Answers

Simple Rigidbody / force question 3 Answers

add torque at position 2 Answers

How to calculate force to apply to move object to a certain distance. 1 Answer


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