Start work to control particle emitters from scripts, and allow getting kart velocity from script
This commit is contained in:
parent
08529e167f
commit
68eb4eb359
@ -100,7 +100,7 @@ namespace Scripting
|
||||
}
|
||||
|
||||
/** Sets the kart's velocity to the specified value. */
|
||||
void setVelocity(int idKart, Vec3* position)
|
||||
void setVelocity(int idKart, SimpleVec3* position)
|
||||
{
|
||||
float x = position->getX();
|
||||
float y = position->getY();
|
||||
@ -110,6 +110,14 @@ namespace Scripting
|
||||
kart->setVelocity(btVector3(x, y, z));
|
||||
}
|
||||
|
||||
/** Gets the kart's velocity */
|
||||
SimpleVec3 getVelocity(int idKart)
|
||||
{
|
||||
AbstractKart* kart = World::getWorld()->getKart(idKart);
|
||||
btVector3 velocity = kart->getVelocity();
|
||||
return SimpleVec3(velocity.getX(), velocity.getY(), velocity.getZ());
|
||||
}
|
||||
|
||||
/** @}*/
|
||||
/** @}*/
|
||||
|
||||
@ -122,6 +130,7 @@ namespace Scripting
|
||||
r = engine->RegisterGlobalFunction("void setVelocity(int id, const Vec3 &in)", asFUNCTION(setVelocity), asCALL_CDECL); assert(r >= 0);
|
||||
//r = engine->RegisterGlobalFunction("void jumpTo(int id, float x, float y)", asFUNCTION(jumpTo), asCALL_GENERIC); assert(r >= 0);
|
||||
r = engine->RegisterGlobalFunction("Vec3 getLocation(int id)", asFUNCTION(getLocation), asCALL_CDECL); assert(r >= 0);
|
||||
r = engine->RegisterGlobalFunction("Vec3 getVelocity(int id)", asFUNCTION(getVelocity), asCALL_CDECL); assert(r >= 0);
|
||||
}
|
||||
|
||||
void registerScriptEnums(asIScriptEngine *engine)
|
||||
|
@ -784,6 +784,9 @@ TrackObjectPresentationParticles::TrackObjectPresentationParticles(
|
||||
xml_node.get("clip_distance", &clip_distance);
|
||||
xml_node.get("conditions", &m_trigger_condition);
|
||||
|
||||
bool auto_emit = true;
|
||||
xml_node.get("auto_emit", &auto_emit);
|
||||
|
||||
try
|
||||
{
|
||||
ParticleKind* kind = ParticleKindManager::get()->getParticles(path);
|
||||
@ -810,7 +813,7 @@ TrackObjectPresentationParticles::TrackObjectPresentationParticles(
|
||||
m_emitter = emitter;
|
||||
}
|
||||
|
||||
if (m_trigger_condition.size() > 0)
|
||||
if (m_trigger_condition.size() > 0 || !auto_emit)
|
||||
{
|
||||
m_emitter->setCreationRateAbsolute(0.0f);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user