- Home /
Find the area of the part of a game object exposed to the air in the direction of its flight
Imagine I am trying to calculate the amount of drag and I need to find the area of exposure of a particular object to the airstream in its direction of flight. I very much hope you understand my question
Thanks in advance, fellow gamedevs!
Answer by Zaeran · Apr 10, 2019 at 04:08 PM
This is doable with a rendertexture.
If you create an orthographic camera and tell it to always face the object, to position itself in the object's direction of travel, and to set up layers to only have the relevant objects be rendered by the camera, the output of that camera will be a front-on view of the object in its direction of travel.
Get the camera to output to a rendertexture, then analyse that texture each frame you perform your drag calculation.
In the texture, each pixel will be a set surface area, depending on your rendertexture size and your camera ortho size. Once you know your surface-area-per-pixel value, you just need to count how many pixels are of the object to get your total exposed surface area.
Your answer
Follow this Question
Related Questions
Rigidbodies flying up in the air on collision 4 Answers
trees and fire just floats into the hair 1 Answer
Area Lights bake 0 Answers
How to end the game 1 Answer