浮力の力を計算するために使用する流体の密度
浮力は Collider2D の Collider2D.density とエフェクターの密度を比較することで計算されます。コライダーの密度がエフェクターの密度よりも低い場合、コライダーは浮かびます。つまり、浮力が増します。コライダーの密度がエフェクターの密度よりも高い場合、コライダーは沈みます。つまり、浮力が減ります。コライダーの密度がエフェクターの密度と等しい場合、浮力は発生せず、コライダーは浮かびも沈みもしません。
Collider2D.density は Rigidbody2D.useAutoMass が True のときのみ設定できることに注意してください。この機能を使って、エフェクター密度に対するコライダーの密度を微調整することができます。必要ない場合は、 Rigidbody2D.useAutoMass を False に設定でき、その場合、 Collider2D.density は 1 に固定されます。したがって、エフェクターの密度が 1 よりも大きい場合に、コライダーは浮き上がり、エフェクターの密度が 1 よりも小さいと、コライダーは沈むようになります。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.