luxeengine / alpha

alpha - deprecated 2015~2016. unrelated to the new engine! view the new engine here - https://luxeengine.com/
MIT License
565 stars 74 forks source link

phoenix; Vector; Vec type and operator overloading #326

Closed tiagolr closed 8 years ago

tiagolr commented 9 years ago

Using Vec type (instead of Vector) and have access to operations like : v = v1 + v2, would be very useful to implement simple linear movement formulas like:

p += v * dt + a * dt * dt / 2;
v += a * dt;

The problem is that the haxe compiler complains about using Vector methods:

var v:Vec = new Vec(0,0);
v.add(v * 2); 

results in : luxe.Vec has no field add (Suggestion: _add)

Any thoughts on this? Can this feature be added, or am i using the abstract class wrongly?

NicoM1 commented 9 years ago

wouldn't you use v + v * 2? isnt that the point of the abstract?

Nico

On Sat, Sep 19, 2015 at 5:48 AM, TiagoLr notifications@github.com wrote:

Using Vec type (instead of Vector) and have access to operations like : v = v1 + v2, would be very useful to implement simple linear movement formulas like:

p += v * dt + a * dt * dt / 2; v += a * dt;

The problem is that the haxe compiler complains about using Vector methods:

var v:Vec = new Vec(0,0); v.add(v * 2);

results in : luxe.Vec has no field add (Suggestion: _add)

Any thoughts on this? Can this feature be added, or am i using the abstract class wrongly?

— Reply to this email directly or view it on GitHub https://github.com/underscorediscovery/luxe/issues/326.

KeyMaster- commented 9 years ago

This could be fixed using @:forward to expose functions of the underlying Vector class. Gotta see why that wasn't done yet, otherwise that could be added.