• 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 MDennis · Jun 13, 2011 at 10:42 AM · forcemovingstopadding

stop adding force

Hello,

Is there a way to stop adding force, instead of having the gravity switched on?

The Scenario is that, whenever i press the left mouse button to move a game object up with add force, i want to be able to say that if i released the button, i want to be able to stop the force adding thus stopping the game object

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
2
Best Answer

Answer by Anxo · Jun 13, 2011 at 11:00 AM

Add force is only applied when ever it is called.

 if(mousebutton)
 {
 add force
 }

if "if" if false, add force is not applied, if your object is still moving its because of the forces that was added. you can increase the drag to make it slow down faster after the force is not longer added. If you want to stop it entirely you can use velocity.vector3.zero but this has unrealistic effects.

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 Yakounet · Sep 02, 2017 at 08:36 AM

The first thing to know is that, as in real workd physics, whent an object is subject to no force, it doesn't stop! It simply continues in a straight line at constant speed. Your object probably slows down because it has drag. As Anxo said, you can either ramp up the drag (its max value being 1'000'000), or set its velocity to zero for a brutal stop.

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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to stop a moving object 2 Answers

Problem when applying forces to a ball 1 Answer

Play Animation and Stop Moving on Enemy Collision 1 Answer

adding force to instantiated ragdoll 4 Answers

How come my boost comes to an abrupt stop? 1 Answer

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