Hello,
Firstly AS is very cool, I was surprised how easy it was to get going.
I've got an issue with a member function that I'm trying to export, Im running it through a free-function so I can convert the vec3 from the AS one to the C++ one. (This is unfortunately necessary as the engine hasn't been completely turned over to the newer one.
But the component object comes out as garbage, but all other methods are fine
// These all work fine.
r = engine->RegisterObjectType("CameraComponent", 0, asOBJ_REF | asOBJ_NOCOUNT); assert(r >= 0);
r = engine->RegisterObjectBehaviour("Component", asBEHAVE_REF_CAST, "CameraComponent@ f()", asFUNCTION((ASHelper::refCast<CaffEnt::Component, CaffComp::CameraComponent>)), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("CameraComponent", "void makeActiveCamera()", asMETHOD(CaffComp::CameraComponent, makeActiveCamera), asCALL_THISCALL); assert(r >= 0);
r = engine->RegisterObjectMethod("CameraComponent", "bool isActive() const", asMETHOD(CaffComp::CameraComponent, isActive), asCALL_THISCALL); assert(r >= 0);
r = engine->RegisterObjectMethod("CameraComponent", "void setFOV(const uint)", asMETHOD(CaffComp::CameraComponent, setFOV), asCALL_THISCALL); assert(r >= 0);
// This gives rubbish for the camera component.
r = engine->RegisterObjectMethod("CameraComponent", "void setLookAt(const Vec3 &in) const", asFUNCTION(CaffGlue::Comp::SetLookAt), asCALL_CDECL_OBJLAST); assert(r >= 0);
// Free func glue.
void SetLookAt(const CaffMath::Vector3 vec3, CaffComp::CameraComponent *camera)
What am I doing wrong?
The AS code as well
@camera = cast<CameraComponent@>(getOwner().getComponent("CameraComponent"));
if(camera !is null)
{
camera.makeActiveCamera(); // works
Vec3 lookat = {0.1f,0.1f,0.1f};
camera.setLookAt(lookat); // does not
}