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 rodridkv · Feb 17, 2011 at 09:38 PM · physicsrigidbodyacceleration

rigidbody acceleration

Hi, is there any way to obtain the acceleration vector of the rigidbody? In the same way that we can obtain the velocity ej: rigidbody.velocity.

The case is that I have rigidbody objects in my scene, to wich I apply some forces, and then I would like to compute the acceleration of the rigidbody at a certain moment.

Thanks!!

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

4 Replies

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

Answer by Jessy · Feb 17, 2011 at 09:51 PM

Instantaneous acceleration doesn't have a meaning in Unity, where rigidbodies are accelerated by forces acting repeatedly at discrete intervals, and stopped without static objects actually exerting forces. You could could do a delta over the smallest possible time step:

acceleration = (rigidbody.velocity - lastVelocity) / Time.fixedDeltaTime;
lastVelocity = rigidbody.velocity;

And if you're talking about acceleration in terms of forces you're applying, instead of measured velocity differences, then just add up whatever you think matters, i.e. stuff you're doing in FixedUpdate plus other forces that happen at irregular intervals.

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

Answer by rodridkv · Feb 18, 2011 at 09:41 AM

Ok, that's more or less what I thought, but I needed some kind of confirmation, and you gave me that!

I'll calculate the acceleration by derivating the velocity as you say. But I think the instantaneous acceleration of a rigidbody or physic object could be useful... I really don't know.

Thanks anyway!

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
2

Answer by HarvesteR · Apr 14, 2011 at 03:59 PM

It's useful for calculating G forces and things like that.

The problem with this method is that there is some numerical "noise" on it...

I have some gauges set up here to measure vertical speed and vertical acceleration and I get some huge jerking movements on the needles...

Vertical speed is more or less ok... it twitches a little when near 0, and some more approaching higher values... It's the derivative of the ship's altitude on the fixed time step (fixedDeltaTime)...

Now, vertical acceleration is the derivative of vertical speed... so it jerks around horribly...

The problem is that this is essentially verlet integration, which is an inherently unstable integration method...

Yeah, Unity really should expose a rigidbody's acceleration... so these things are more convenient.

Cheers

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 rodridkv · Apr 15, 2011 at 07:38 AM 0
Share

You're right. I have used Euler and Runge-$$anonymous$$utta integration methods but you can't get rid of the noise.

$$anonymous$$aybe with a filter it would work better, but for now the solution fits for my problem.

When you have a system of various rigidbodies interacting with each other, it's very useful knowing the acceleration at any fixed time. So, I agree with you

avatar image HarvesteR · May 16, 2011 at 04:38 PM 0
Share

$$anonymous$$aybe filtering the noise out is the best way to do it... but it does seem like an awfully big hassle just to get a reliable acceleration value off a rigidbody... (which it really won't be if you're filtering too much ;) )

avatar image
2

Answer by Elecman · Sep 29, 2014 at 09:10 PM

You can also use the LinearAcceleration() function here:

http://wiki.unity3d.com/index.php/3d_Math_functions

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.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Overcome drag 1 Answer

How to Tilt a Spaceship Based on Inertia/Acceleration Force Separate from Facing Direction? 2 Answers

strange unrealisticly physic problems about velocity/gravity acceleration 2 Answers

Confusion with AddForce with ForceMode.Acceleration 1 Answer

Simulating Fighter Jet Physics (with addForce () ) 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