Archived post by WhileRomeBurns

if you want to use `targetv`, `airresist`, `drag` you could do the math yourself and store them in custom attributes like `@c_targetv` so bullet doesn’t pick um up and make nans

it’ll be something like this:

“`float imass = 1.0 / @mass;
@c_airresist = @c_airresist * @c_drag; if (@c_airresist > 0) {
    // the relative ang vel     v@v -= v@c_targetv;
    // quadratic drag     v@v *= 1.0 / ( (@c_airresist * imass * @TimeInc * length(v@v)) + 1.0 );
    // restore frame     v@v += v@c_targetv; }“`

i don’t see how that could produce a nan unless c_airresist was negative or mass was zero

which you can add checks for if you like

just skip zero-mass dudes