Bound Physical Object class to scripts
This commit is contained in:
parent
41a4619120
commit
f3a41a2631
@ -11,5 +11,6 @@ void onTrigger()
|
||||
//track_obj_manager.disable("hayBail.b3d");
|
||||
TrackObject @t_obj = getTrackObject("hayBail.b3d");
|
||||
t_obj.setEnable(false);
|
||||
PhysicalObject @hay = t_obj.getPhysicalObject();
|
||||
squashKart(0,35.0); //id of kart,time to squash
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "script_track.hpp"
|
||||
#include "states_screens/dialogs/tutorial_message_dialog.hpp"
|
||||
#include "tracks/track_object_manager.hpp"
|
||||
#include "tracks/track_object.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include <iostream> //debug
|
||||
namespace Scripting
|
||||
@ -81,6 +82,9 @@ namespace Scripting
|
||||
r = engine->RegisterObjectType("TrackObject", 0, asOBJ_REF | asOBJ_NOCOUNT); assert(r >= 0);
|
||||
r = engine->RegisterGlobalFunction("TrackObject @getTrackObject(string &in)", asFUNCTION(getTrackObject), asCALL_GENERIC); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("TrackObject", "void setEnable(bool status)", asMETHOD(TrackObject, setEnable), asCALL_THISCALL); assert(r >= 0);
|
||||
r = engine->RegisterObjectType("PhysicalObject", 0, asOBJ_REF | asOBJ_NOCOUNT); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("TrackObject", "PhysicalObject @getPhysicalObject()", asMETHOD(TrackObject, getPhysicalObjectForScript), asCALL_THISCALL); assert(r >= 0);
|
||||
//r = engine->RegisterObjectMethod("TrackObject", "const PhysicalObject @getPhysicalObject()", asMETHOD(TrackObject, getPhysicalObject), asCALL_THISCALL); assert(r >= 0);
|
||||
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,8 @@ public:
|
||||
|
||||
const PhysicalObject* getPhysicalObject() const { return m_physical_object; }
|
||||
PhysicalObject* getPhysicalObject() { return m_physical_object; }
|
||||
//Due to above overload AngelScript cannot decide which function to bind
|
||||
PhysicalObject* getPhysicalObjectForScript() { return m_physical_object; }
|
||||
|
||||
const core::vector3df getInitXYZ() const { return m_init_xyz; }
|
||||
const core::vector3df getInitRotation() const { return m_init_hpr; }
|
||||
|
Loading…
Reference in New Issue
Block a user