First of all, for trees may be used a simplified physics engine, as there are tonns of trees on the terrain.
I think behaviour of the tree must depend on 2 or 3 things:
1. Tree's thickness, which will also be a modified tree's mass/weight to reduce CPU load,
2. Vehicle's pulse (or impulse, p=m*v),
(3). Height of the point of collision with a tree (this parameter can be also thrown away to reduce calculations).
There can be a constant (for example, a Critical_multiplier_for_thickness), and
if (Vehicle's_Impulse * Height_of_Collision > Tree's_Thickness * Critical_multiplier_for_thickness)
{
Tree_Falls();
}
else
{
Tree_Doesnt_Fall();
};
or even simplier, each Tree's_Thickness will be that Critical impulse to fall the tree. and then:
if (Vehicle's_Impulse * Height_of_Collision > Tree's_Critical_Thickness )
{
Tree_Falls();
}
else
{
Tree_Doesnt_Fall();
};
If CPU is too loaded then we can calculate 2 different situations without Height_of_Collision, because land vehicles have similar height (+-0.5m):
if (Collided_Vehicle_Type == Type_Land_Vehicle) // collision with a land_veh
{
if (Vehicle's_Impulse > Tree's_Critical_Thickness_for_Land_Vehicles ) // just one <, and no *
{
Tree_Falls();
}
else
{
Tree_Doesnt_Fall();
};
}
else // collision with an air_veh
{
if (Vehicle's_Impulse > Tree's_Critical_Thickness_for_Air_Vehicles ) // just one >, and no *
{
Tree_Falls();
}
else
{
Tree_Doesnt_Fall();
};
};
well, actually, i'm not a pro programmer, I don't know what is faster: (1 IF== and 1 IF>) or (* and IF>)?
And, a question about terramorphing. I meant, will the engine allow to modify the terrain during the gameplay (to simulate digging) ?