A basic library for vectors. Vector library per se might be a misnomer because the point of the library was so that one doesn't need to fiddle around with vectors, just that vectors are used internally. However the library does come with in built functions for things like dot and cross products in the case the user wants to work at a lower level. More for proof of concept than anything else.
Update History:
04/12/06 - v1.02:
- Added short demonstration module, more strange functions can be found in the module, so please check it out.
- Changed the way family of LocAtAngleTo* functions work. the angle of 0.0 degrees is the facing of the reference location or object.
- Added slightly more abstraction.
Notes:
Generally, a vector has a magnitude, and a direction. In the case of NWN2, vectors are used to represent positions in an area. these vectors consist of three parts, the x, y and z coordinates because NWN2 Areas are three dimensional.
Uses:
Because vectors are so abstract, they're useful to find locations relative to other objects or locations.
e.g. LocInFrontOfObj(oPC, 5.0);
would return a *Location* (not vector) 5.0 units in front of the PC.
therefore you can use it in the context:
ActionJumpToLocation(LocBehindObj(oPC, 5.0));
And the action subject will teleport 5.0 units behind the PC.
This was true for NWN too. Computationally, I guess it is all based on the origin point of the current area. Likewise, all the models are cartesian based, and that is probably the easiest way to render them in the engine.
It is just a personal gripe of mine... I believe area of effect in NWN was calculated just on the x-y plane. For NWN that was OK, since the altitude changes of the terrain were pretty small, but not true w/ NWN2, like in Highcliff.
It has been a hang-up since DOOM , where you could chain-saw down a monster at the top of a 6 story lift when you were down at the bottom.
Shouldn't a 3D vector be described as an azimuth (degrees or radians from North), an elevation (degrees up or down from level) and a distance (a.k.a. magnitude)?
Particularly for spell effects and ranged weapons, that is an easier implementation than cartesian coordinates, where the magnitude is Sqrt(X^2+Y^2+Z^2) (although NWScripts can do the math).
10 - A Masterpiece, Genuinely Groundbreaking 9 - Outstanding, a Must Have 8 - Excellent, Recommended to Anyone 7 - Very Good, Deserves a Look 6 - Good, Qualified Recommendation 5 - Fair, Solid yet Unremarkable 4 - Some Merit, Requires Improvements 3 - Poor Execution, Potential Unrealized 2 - Very Little Appeal 1 - Not Recommended to Anyone