Ckathode / archimedes-ships

Archimedes' Ships Minecraft mod
MIT License
49 stars 53 forks source link

Delete strange line #6

Closed anion155 closed 9 years ago

Ckathode commented 9 years ago

This line is required to line out the ship with the grid. It rotates the blocks to the nearest straight angle relative to the grid while disassembling the ship.

anion155 commented 9 years ago

This line does not change anything. It's instantly rewriting by this (float) Math.toRadians(ship.rotationYaw)

Ckathode commented 9 years ago

Please note the call to the Math.round function. I will give you an example: yaw = 132.0; yaw / 90.0 = 1.467; Math.round(yaw / 90.0) = Math.round(1.467) = 1.0; Math.round(yaw / 90.0) * 90.0 = 1.0 * 90.0 = 90.0; A yaw of 132.0 degrees results in 90.0 degrees.

anion155 commented 9 years ago

Well, maybe you wanted to do something like this:

float yaw = Math.round(ship.rotationYaw / 90F) * 90F;
yaw = (float) Math.toRadians(yaw);

instead of

float yaw = Math.round(ship.rotationYaw / 90F) * 90F;
yaw = (float) Math.toRadians(ship.rotationYaw);

'cause the result of Math.round(ship.rotationYaw / 90F) * 90F doesn't saves anywhere.

anion155 commented 9 years ago

or even like this

ship.rotationYaw = Math.round(ship.rotationYaw / 90F) * 90F;
float yaw = (float) Math.toRadians(ship.rotationYaw);
Ckathode commented 9 years ago

Aha, I see now. Thank you! I'm sorry for not understanding you the first time. It has always worked well because the ship always aligns before disassembling.