Changed trigger creation method to use Vec3

This commit is contained in:
Sachith Hasaranga Seneviratne 2014-07-15 22:19:41 +05:30
parent acd11ce738
commit cbebfcd428
2 changed files with 11 additions and 8 deletions

View File

@ -1,9 +1,11 @@
void onStart()
{
displayMessage("Track Loaded");
//For green valley sheep test. See sheep_approach.as
createTrigger("haybail_deactivate", 69.97 ,8.08 ,-107.84, 20.00); //follows xzy for now
createTrigger("haybail",100.72, 10.20,-26.22 , 30.00);
Vec3 creationloc = Vec3(69.97 ,8.08 ,-107.84);
Vec3 creationloc2 = Vec3(100.72, 10.20,-26.22);
createTrigger("haybail_deactivate", creationloc, 20.00);
createTrigger("haybail",creationloc2 , 30.00);
TrackObject @t_obj = getTrackObject("cow");
SoundEmitter @cowmoo = t_obj.getSoundEmitter();

View File

@ -141,7 +141,7 @@ namespace Scripting
r = engine->RegisterGlobalFunction("void enableAnimation(string &in)", asFUNCTION(enableAnimation), asCALL_GENERIC); assert(r >= 0);
r = engine->RegisterGlobalFunction("void enableTrigger(string &in)", asFUNCTION(enableTrigger), asCALL_GENERIC); assert(r >= 0);
r = engine->RegisterGlobalFunction("void disableTrigger(string &in)", asFUNCTION(disableTrigger), asCALL_GENERIC); assert(r >= 0);
r = engine->RegisterGlobalFunction("void createTrigger(string &in,float x,float y,float z, float distance)",
r = engine->RegisterGlobalFunction("void createTrigger(string &in,Vec3 &in, float distance)",
asFUNCTION(createTrigger), asCALL_GENERIC); assert(r >= 0);
r = engine->RegisterGlobalFunction("string getKeyBinding(int input)", asFUNCTION(getKeyBinding), asCALL_GENERIC); assert(r >= 0);
@ -262,10 +262,11 @@ namespace Scripting
void createTrigger(asIScriptGeneric *gen)
{
std::string *script_name = (std::string*)gen->GetArgAddress(0);
float x = gen->GetArgFloat(1);
float y = gen->GetArgFloat(2);
float z = gen->GetArgFloat(3);
float distance = gen->GetArgFloat(4); //triggering distance
Vec3 *creation_loc = (Vec3*)gen->GetArgAddress(1);
float x = creation_loc->getX();
float y = creation_loc->getY();
float z = creation_loc->getZ();
float distance = gen->GetArgFloat(2); //triggering distance
core::vector3df posi(x, y, z);
core::vector3df hpr(0, 0, 0);
core::vector3df scale(1.0f, 1.0f, 1.0f);