Hello,
so it compiles without errors or AngelScript freaking out. I can even create the component inside the editor. However, when I do:
movement = node.CreateComponent(“CharacterMovement”);
it says: Can’t implicitly convert from ‘Component@&’ to ‘CharacterMovement@’
This is how the component is being registered:
void CharacterMovement::RegisterObject(Context* context)
{
context->RegisterFactory(“Physics”);
URHO3D_ATTRIBUTE(“Move Speed”, float, moveSpeed_, 0.0f, AM_DEFAULT);
URHO3D_ATTRIBUTE(“Move Dir”, Vector3, moveDir_, Vector3::ZERO, AM_DEFAULT);
}
CharacterMovement* CharacterMovement::CharacterMovement_CharacterMovement_Context()
{
Context* context = GetScriptContext();
return new CharacterMovement(context);
}
void CharacterMovement::RegisterAPI(asIScriptEngine* engine)
{
engine->RegisterObjectType(“CharacterMovement”, 0, asOBJ_REF);
engine->RegisterObjectBehaviour(“CharacterMovement”, asBEHAVE_FACTORY, “CharacterMovement@+ f()”, AS_FUNCTION(CharacterMovement_CharacterMovement_Context), AS_CALL_CDECL);
RegisterMembers_LogicComponent<CharacterMovement>(engine, "CharacterMovement");
engine->RegisterObjectMethod("CharacterMovement", "void CreatePhysicsComponents()", asMETHOD(CharacterMovement, CreatePhysicsComponents), asCALL_THISCALL);
}