Hello dear FreeMathHelp forum, at first, sorry for my english if i make a mistake at it, i'm German.
And please move the topic in the right category if it is in the wrong category.
So, i made a game server and i'm a scripter in it. So, to go with the topic, i have a Tree, i try to make it fall with the ground height, the stand rotation are 0.0(zero) deg., and 90.0 deg. are laying straight, the problem is that the tree are laying in the air or in the ground because of the terrain height, so i calculate the height of the tree and the height of the ground where it should fall and laying, so for explain:
Tree Z height: 23.0 deg.
Z height terrain: 28.0 deg.
So if i try to make it straight fall to 90.0 deg. the Tree are under the terrain because the terrain are 28 deg. and the tree are 23 deg.
I try by myself to make an calculation but it is wrong:
if(layZ > z) layRot = -(layZ - z) - 90;
if(layZ < z) layRot = (z - layZ) + 90;
So it works like this, if the Lay height are over the normal height then the layRot are equal -(28.0 - 23.0), so it is then -5.
"z" is the tree height and "layZ" are the height of the terrain where it should fall, "layRot" is zero(0) and there should be the rotation of the tree calculates of the heights.
So it calculate how height it is between the height A and height B, but its not the rotation but height Coordinate, so how can i calculate to become the lay rotation that the Tree are not floating in the air and its not in the ground?
I hope you guys can me help, i'm not very good at Math.
Regards.
And please move the topic in the right category if it is in the wrong category.
So, i made a game server and i'm a scripter in it. So, to go with the topic, i have a Tree, i try to make it fall with the ground height, the stand rotation are 0.0(zero) deg., and 90.0 deg. are laying straight, the problem is that the tree are laying in the air or in the ground because of the terrain height, so i calculate the height of the tree and the height of the ground where it should fall and laying, so for explain:
Tree Z height: 23.0 deg.
Z height terrain: 28.0 deg.
So if i try to make it straight fall to 90.0 deg. the Tree are under the terrain because the terrain are 28 deg. and the tree are 23 deg.
I try by myself to make an calculation but it is wrong:
if(layZ > z) layRot = -(layZ - z) - 90;
if(layZ < z) layRot = (z - layZ) + 90;
So it works like this, if the Lay height are over the normal height then the layRot are equal -(28.0 - 23.0), so it is then -5.
"z" is the tree height and "layZ" are the height of the terrain where it should fall, "layRot" is zero(0) and there should be the rotation of the tree calculates of the heights.
So it calculate how height it is between the height A and height B, but its not the rotation but height Coordinate, so how can i calculate to become the lay rotation that the Tree are not floating in the air and its not in the ground?
I hope you guys can me help, i'm not very good at Math.
Regards.

