beeglebug Posted October 30, 2013 Share Posted October 30, 2013 I'm trying to port some code I initially wrote with my own framework to Phaser, but i've run across some issues when trying to find the equivalent of a Vector2. Phaser seems to use it's Point class to represent a lot of things which are more traditionally thought of a Vectors, such as acceleration and velocity, so am I right to start using Point wherever I previously used my Vector2 class? If so, I have a lot of additional functions which I would like to add to the source, methods for common vector operations like normalize, get magnitude, lerp, dot product etc. I have the code written, tested and commented, and could add it to the Point class in no time, but I thought I would check first to see if that is definitely the right place for it. Link to comment Share on other sites More sharing options...
rich Posted October 31, 2013 Share Posted October 31, 2013 Yeah I've got a full Vector2 class with all of those things you mention in it, I just didn't fold it into the core yet and am a bit hesitant to do so - it seems every framework has their own vec2 but in reality pixi already uses part of glMatrix which has fantastic v2 support, so I'm in two minds about just using that outright, or rolling in the version I created anyway (which takes lots of inspiration from glMatrix anyway with regard to object re-use). Link to comment Share on other sites More sharing options...
beeglebug Posted October 31, 2013 Author Share Posted October 31, 2013 Well as a stop gap, do you mind if I do a pull request with a few handy Vec2 things into the Point class? Just to tide us over until you decide what to replace the class with? Just things like normalize and getMagnitude really, as i'm finding it overly long winded doing simple things like calculating distances at the moment. Link to comment Share on other sites More sharing options...
beeglebug Posted October 31, 2013 Author Share Posted October 31, 2013 I've created a pull request for this (#150) Link to comment Share on other sites More sharing options...
onedayitwillmake Posted November 2, 2013 Share Posted November 2, 2013 I vote for using the same one pixi is using behind the scenes. Less confusion for users Link to comment Share on other sites More sharing options...
Recommended Posts