Added move to meshes, created an example in greenvalley
This commit is contained in:
parent
8292b4bce7
commit
84fe9b09b7
@ -6,6 +6,8 @@ void sheep_dance()
|
||||
Mesh @sheepMesh = t_obj.getMesh();
|
||||
//displayMessage("moo");
|
||||
sheepMesh.setLoop(1,3); //rapid-nod sheep
|
||||
Vec3 newloc = Vec3(2,3,4);
|
||||
sheepMesh.move(newloc);
|
||||
//runScript("sheep_approach");
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,8 @@ void onUpdate()
|
||||
|
||||
TrackObject @t_obj = getTrackObject("anim_sheep2.b3d");
|
||||
Mesh @sheepMesh = t_obj.getMesh();
|
||||
Vec3 newloc = Vec3(2,-2,-2);
|
||||
sheepMesh.move(newloc);
|
||||
if (sheepMesh.getCurrentFrame()==2){
|
||||
sheepMesh.setLoop(8,48);
|
||||
sheepMesh.setCurrentFrame(9);
|
||||
|
@ -6,7 +6,7 @@ void added_script()
|
||||
Vec3 b;
|
||||
b=a;
|
||||
Vec3 c = Vec3();
|
||||
Vec3 d = Vec3(2,3,4);
|
||||
Vec3 d = Vec3(2,3,0);
|
||||
printVec3(d); */
|
||||
}
|
||||
|
||||
|
@ -69,9 +69,13 @@ namespace Scripting
|
||||
{
|
||||
((ThreeDAnimation*)(memory))->setPaused(mode);
|
||||
}
|
||||
void move(void *memory) //TODO get other params using vec3
|
||||
void move(Vec3 *new_pos,void *memory) //TODO get other params using vec3
|
||||
{
|
||||
|
||||
core::vector3df xyz = core::vector3df(0, 0, 0);
|
||||
xyz.X = new_pos->getX();
|
||||
xyz.Y = new_pos->getY();
|
||||
xyz.Z = new_pos->getZ();
|
||||
core::vector3df hpr = core::vector3df(0, 0, 0);
|
||||
core::vector3df scale = core::vector3df(1, 1, 1);
|
||||
((TrackObjectPresentationMesh*)(memory))->move(xyz, hpr, scale);
|
||||
@ -164,7 +168,7 @@ namespace Scripting
|
||||
r = engine->RegisterObjectMethod("Mesh", "void setLoop(int start, int end)", asFUNCTION(setLoop), asCALL_CDECL_OBJLAST); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("Mesh", "int getCurrentFrame()", asFUNCTION(getCurrentFrame), asCALL_CDECL_OBJLAST); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("Mesh", "void setCurrentFrame(int frame)", asFUNCTION(setCurrentFrame), asCALL_CDECL_OBJLAST); assert(r >= 0);
|
||||
|
||||
r = engine->RegisterObjectMethod("Mesh", "void move(Vec3 &in)", asFUNCTION(move), asCALL_CDECL_OBJLAST); assert(r >= 0);
|
||||
|
||||
//Curve based Animation
|
||||
r = engine->RegisterObjectType("Animator", 0, asOBJ_REF | asOBJ_NOCOUNT); assert(r >= 0);
|
||||
|
Loading…
Reference in New Issue
Block a user