Are Phaser.Points Vectors?

Recommended Posts

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.

Share this post

Link to post
Share on other sites

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).

Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.