Start working on scripting API to move objects
This commit is contained in:
parent
0fdc7a2d98
commit
74f19f0cbc
@ -243,7 +243,8 @@ namespace Scripting
|
||||
r = engine->RegisterObjectMethod("TrackObject", "Mesh@ getMesh()", asMETHOD(TrackObject, getMesh), asCALL_THISCALL); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("TrackObject", "ParticleEmitter@ getParticleEmitter()", asMETHOD(TrackObject, getParticleEmitter), asCALL_THISCALL); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("TrackObject", "Animator@ getIPOAnimator()", asMETHOD(TrackObject, getIPOAnimator), asCALL_THISCALL); assert(r >= 0);
|
||||
// TODO: add move method
|
||||
r = engine->RegisterObjectMethod("TrackObject", "void moveTo(const Vec3 &in, bool)", asMETHOD(TrackObject, moveTo), asCALL_THISCALL); assert(r >= 0);
|
||||
|
||||
|
||||
// PhysicalObject
|
||||
r = engine->RegisterObjectMethod("PhysicalObject", "bool isFlattenKartObject()", asMETHOD(PhysicalObject, isFlattenKartObject), asCALL_THISCALL); assert(r >= 0);
|
||||
|
@ -31,9 +31,9 @@ namespace Scripting
|
||||
float y;
|
||||
float z;
|
||||
|
||||
float getX() { return x; }
|
||||
float getY() { return y; }
|
||||
float getZ() { return z; }
|
||||
float getX() const { return x; }
|
||||
float getY() const { return y; }
|
||||
float getZ() const { return z; }
|
||||
|
||||
SimpleVec3() : x(0), y(0), z(0) { }
|
||||
SimpleVec3(float p_x, float p_y, float p_z) : x(p_x), y(p_y), z(p_z) { }
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "items/item.hpp"
|
||||
#include "physics/physical_object.hpp"
|
||||
#include "scriptengine/scriptvec3.hpp"
|
||||
#include "tracks/track_object_presentation.hpp"
|
||||
#include "utils/cpp2011.hpp"
|
||||
#include "utils/no_copy.hpp"
|
||||
@ -212,6 +213,15 @@ public:
|
||||
PhysicalObject* getPhysics() { return m_physical_object; }
|
||||
/** Hide or show the object */
|
||||
void setEnabled(bool mode);
|
||||
|
||||
void moveTo(const Scripting::SimpleVec3* pos, bool isAbsoluteCoord)
|
||||
{
|
||||
move(core::vector3df(pos->getX(), pos->getY(), pos->getZ()),
|
||||
core::vector3df(0.0f, 0.0f, 0.0f), // TODO: preserve rotation
|
||||
core::vector3df(1.0f, 1.0f, 1.0f), // TODO: preserve scale
|
||||
true, // updateRigidBody
|
||||
isAbsoluteCoord);
|
||||
}
|
||||
/* @} */
|
||||
/* @} */
|
||||
/* @} */
|
||||
|
Loading…
x
Reference in New Issue
Block a user