Added setVelocity to script functions for karts
This commit is contained in:
@@ -2,5 +2,8 @@ void onTrigger()
|
||||
{
|
||||
displayMessage("Bananas! Bananas! Everywhere!");
|
||||
squashKart(0,35.0); //id of kart,time to squash
|
||||
teleportKart(0, 5, 5 ,5); //id of kart, x,y,z
|
||||
//teleportKart(0, 5, 5 ,5); //id of kart, x,y,z
|
||||
setVelocity(0, 5, 50 , 8); //id of kart, velocity //components x,y,z
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -52,11 +52,22 @@ namespace Scripting{
|
||||
s.setRotation(btQuaternion(btVector3(0.0f, 1.0f, 0.0f), angle));
|
||||
World::getWorld()->moveKartTo(kart, s);
|
||||
}
|
||||
void setVelocity(asIScriptGeneric *gen)
|
||||
{
|
||||
int id = (int)gen->GetArgDWord(0);
|
||||
float x = gen->GetArgFloat(1);
|
||||
float y = gen->GetArgFloat(2);
|
||||
float z = gen->GetArgFloat(3);
|
||||
|
||||
AbstractKart* kart = World::getWorld()->getKart(id);
|
||||
kart->setVelocity(btVector3(x, y, z));
|
||||
}
|
||||
void registerScriptFunctions(asIScriptEngine *engine)
|
||||
{
|
||||
int r;
|
||||
r = engine->RegisterGlobalFunction("void squashKart(int id, float time)", asFUNCTION(squashKart), asCALL_GENERIC); assert(r >= 0);
|
||||
r = engine->RegisterGlobalFunction("void teleportKart(int id, float x, float y,float z)", asFUNCTION(teleportKart), asCALL_GENERIC); assert(r >= 0);
|
||||
r = engine->RegisterGlobalFunction("void setVelocity(int id, float x, float y,float z)", asFUNCTION(setVelocity), asCALL_GENERIC); assert(r >= 0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user