Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/Formation.js
Show First 20 Lines • Show All 886 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Returns true if the two given angles (in radians) | * Returns true if the two given angles (in radians) | ||||
* are smaller than the maximum turning angle of the formation and therfore allow | * are smaller than the maximum turning angle of the formation and therfore allow | ||||
* the formation turn without reassigning positions. | * the formation turn without reassigning positions. | ||||
*/ | */ | ||||
Formation.prototype.AreAnglesSimilar = function(a1, a2) | Formation.prototype.AreAnglesSimilar = function(a1, a2) | ||||
{ | { | ||||
const d = Math.abs(a1 - a2) % 2 * Math.PI; | const d = Math.abs(a1 - a2) % (2 * Math.PI); | ||||
return d < this.maxTurningAngle || d > 2 * Math.PI - this.maxTurningAngle; | return d < this.maxTurningAngle || d > 2 * Math.PI - this.maxTurningAngle; | ||||
}; | }; | ||||
/** | /** | ||||
* Set formation controller's speed based on its current members. | * Set formation controller's speed based on its current members. | ||||
*/ | */ | ||||
Formation.prototype.ComputeMotionParameters = function() | Formation.prototype.ComputeMotionParameters = function() | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 157 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator