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
1
Question by Crystalline · Nov 06, 2013 at 02:41 PM · speedmoveforce

Constant force, not constant at all!!

Hello.

I have attached a constant force component to a rigid body and then I use **transform.constantForce.force = (transform.forward 50);*

But, by time the speed keeps increasing, so its not constant,not at all.. And another problem, it wont even update when I rotate the object, keeps going on the old axis.

Am I missing something, or what ? I am getting crazy here trying to make a cube move by force which should be like humanoid constant force.

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 Jamora · Nov 06, 2013 at 02:44 PM 0
Share

Are you constantly reapplying the multiplied force in Update or FixedUpdate?

avatar image Crystalline · Nov 06, 2013 at 02:46 PM 0
Share

I use FixedUpdate , and an Input.Get$$anonymous$$ey().

avatar image meat5000 ♦ · Nov 06, 2013 at 02:47 PM 0
Share

If you only want 1 hit of force, try Get$$anonymous$$eyDown

avatar image Crystalline · Nov 06, 2013 at 04:19 PM 0
Share

Thanks all for answers! I think I misunderstood what acceleration,velocity and force means. Thanks to you I now know,and I managed to fix what I needed.

3 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by drod7425 · Nov 06, 2013 at 03:09 PM

If I'm reading the documentation correctly - http://docs.unity3d.com/Documentation/Components/class-ConstantForce.html - it looks like constant force applies linear acceleration to an object. So imagine you're in a car and you press the gas pedal all the way down. You're not going to be go 100MPH immediately. It will take some time for the car to get up to that speed and, depending on your car, it might get there. But throughout the acceleration to 100, you're not increasing the amount of force (ie. pushing the gas pedal down farther). You're applying a constant force and your car is going faster and faster.

If you want a constant speed, try using Transform.Translate - https://docs.unity3d.com/Documentation/ScriptReference/Transform.Translate.html

Hope that helps!

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
3

Answer by Bunny83 · Nov 06, 2013 at 03:05 PM

It seems you are a bit confused about force and velocity. A constant force will linearly accelerate your object. If you want a constant velocity, just set the velocity of the rigid body once. If you set "drag" to 0 (which simulates air-resistance) the velocity will stay constant and moves the object at the same speed.

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
1

Answer by tanoshimi · Nov 06, 2013 at 03:08 PM

ConstantForce will apply the force every frame until you change the force. Please check your code and ensure that you are only setting the constant force once, not calling it in a loop, for example.

If you only want the force to be applied while a key is held, say, then you should be looking at AddForce instead.

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 drod7425 · Nov 06, 2013 at 03:14 PM 0
Share

Oh, that might be more what OP's looking for. I thought OP didn't want to see acceleration.

avatar image tanoshimi · Nov 06, 2013 at 03:26 PM 0
Share

It also depends whether we're talking about an object moving in frictionless space, in which case I agree with your answer that it's constant velocity the OP is looking for, not constant force. However, if it's a body experiencing drag, resistance, or friction on a surface, constant force will be required to maintain s$$anonymous$$dy state. We need more info to tell!

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

20 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

Related Questions

When applying AddRelativeForce object reaches higher speed when rotated 1 Answer

How do I spread a movement over several frames instead of one? 1 Answer

i am not able to increase the speed of ball perodically in pong, in this code the speed of ball decrease while playing so help with this, how to increase speed of ball perodically?, 0 Answers

Im using add force to make a 'ship' go forward, if i release the key is there any way to slow it gradually? 1 Answer

How to control the speed of the projectile motion? 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