Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: Roger Lee on July 03, 2016, 07:32:13 PM

Title: Float Round Down Action
Post by: Roger Lee on July 03, 2016, 07:32:13 PM
This is a variation of the FloatRound Playmaker action that only rounds down instead of to nearest.

Unity's rotation system is flawed because it uses 0-360 instead of 0-359.  0 and 360 are the same number on a full rotation scale.  Float Clamping between 0-359 causes a 1/2 degree inaccuracy because 0 only gets to .501 before rounding to 1 and there is no rounding from 359 up to 0.  Therefore 0 never gets a full degree for display.

To make a long story short, I needed a proper system to display angles for a submarine periscope.  This 1/2 degree inaccuracy can cause a torpedo shot at 3500 meters to off by 10's of meters.  By rounding the floats 0-359 down, 0 gets back its full 1 degree of range.  Then it was just a matter of calibrating the periscope plus 1/2 degree.

Anyway, I thought someone might find this useful.