Posted: Sat Feb 07, 2009 12:52 pm
Minor JavaScript changes:
- Entity.position and Entity.orientation are now read-write, and Entity.setPosition() and Entity.setOrientation() are therefore deprecated as of 1.73. (Note: deprecations in 1.73 may be removed in 1.74 already, depending on how the Grand Plan advances.) Statements like ship.position.x += 100 still don’t work as expected, but making position read-only didn’t actually affect that, so what’s the point?
- Entity.ID and Entity.entityWithID() are now deprecated, along with the ability to pass an ID instead of an Entity object. I know of no good reason to be using any of these. (Note: this does not affect System.ID.)
- Added toSource() method to Vector and Quaternion. This function is similar to toString() returns a string that can be used as JavaScript code – for example, “Quaternion(-0.470127, 0.391883, -0.497289, 0.614908)” instead of “(-0.470127 + 0.391883i - 0.497289j + 0.614908k)”.
- Vectors and quaternions can now be constructed with syntax like Vector(x, y, z) instead of new Vector(x, y, z). This is not necessarily better in general, but it increases flexibility – specifically, it allows the use of apply() as seen at the bottom of oolite-global-prefix.js. Feel free to ignore this bullet point. :-)