以下を使用して、Angelscript に Vec3 値型を登録しました。
RegisterObjectType("Vec3", sizeof(glm::vec3), asOBJ_VALUE | asGetTypeTraits<glm::vec3>());
その型のコンストラクタとデストラクタ関数も登録しました。
別のタイプ「Transform」を登録し、C++ クラス メソッド「const glm::vec3& GetTranslation()」に対応するメソッド「Vec3 GetTranslation()」を指定しました。
RegisterObjectMethod("Transform", "Vec3 GetTranslation()", asMETHOD(Transform, GetTranslation), asCALL_THISCALL);
これは、Angelscript で 2 つを使用する方法です。
Vec3 v = transform.GetTranslation();
そして、私はこのエラーが発生しています:
No appropriate opAssign method found in 'Vec3' for value assignment
代入演算子または演算子を登録する正しい方法は何ですか?
私はこれを試しました:
RegisterObjectMethod("Vec3", "Vec3 opAssign(const Vec3 &in)", asMETHOD(glm::vec3, operator=), asCALL_THISCALL);
そして、このコンパイルエラーが発生しました:
error: no matches converting function 'operator=' to type 'void (struct glm::detail::tvec3<float, (glm::precision)0u>::*)()'|
note: in expansion of macro 'asMETHOD'|
note: candidates are: template<class U> glm::detail::tvec3<T, P>& glm::detail::tvec3<T, P>::operator=(const glm::detail::tvec3<U, P>&) [with U = U; T = float; glm::precision P = (glm::precision)0u]
note: glm::detail::tvec3<T, P>& glm::detail::tvec3<T, P>::operator=(const glm::detail::tvec3<T, P>&) [with T = float; glm::precision P = (glm::precision)0u]|