Hi,
I'd like to register my own math with angelscript and tried to get some inspiration from the scriptmath example. Now I have a few questions.
Why is this special contstructor function needed and do I need a destructor (or does AngelScript free the allocated memory)?
My add and assign operator is working exactly the same way as in the example. So I could copy the provided code. My add operator however is different then yours. It looks like this:
template<typename T>
struct Vector3_t
{
Vector3_t operator+(const Vector3_t &v) const
{
return Vector3_t(x + v.x, y + v.y, z + v.z);
}
};
I tried to register this operator the same way as add assign, but it didn't really work.
engine->RegisterObjectBehaviour("Vector3", asBEHAVE_ADD, "Vector3 f(const Vector3 &in) const", asMETHODPR(Vector3, operator+, (const Vector3 &) const, Vector3), asCALL_THISCALL); //not working
Is this possible at all or am I making a minor mistake.
Thanks for the help (and the nice engine)!