Add better teleport function
This commit is contained in:
parent
63b23d9e65
commit
2056cd3e91
@ -62,6 +62,18 @@ namespace Scripting
|
||||
World::getWorld()->moveKartTo(kart, s);
|
||||
}
|
||||
|
||||
/** Teleports the kart to the specified Vec3 location */
|
||||
void teleportExact(int idKart, SimpleVec3* position)
|
||||
{
|
||||
AbstractKart* kart = World::getWorld()->getKart(idKart);
|
||||
Vec3 v(position->getX(), position->getY(), position->getZ());
|
||||
kart->setXYZ(v);
|
||||
btTransform s;
|
||||
s.setRotation(kart->getRotation());
|
||||
s.setOrigin(v);
|
||||
World::getWorld()->moveKartTo(kart, s);
|
||||
}
|
||||
|
||||
/** Attempts to project kart to the given 2D location, to the position
|
||||
* with height 0, at a 45 degree angle.
|
||||
*/
|
||||
@ -146,6 +158,10 @@ namespace Scripting
|
||||
mp ? WRAP_FN(teleport) : asFUNCTION(teleport),
|
||||
call_conv); assert(r >= 0);
|
||||
|
||||
r = engine->RegisterGlobalFunction("void teleportExact(int id, const Vec3 &in)",
|
||||
mp ? WRAP_FN(teleportExact) : asFUNCTION(teleportExact),
|
||||
call_conv); assert(r >= 0);
|
||||
|
||||
r = engine->RegisterGlobalFunction("void setVelocity(int id, const Vec3 &in)",
|
||||
mp ? WRAP_FN(setVelocity) : asFUNCTION(setVelocity),
|
||||
call_conv); assert(r >= 0);
|
||||
|
Loading…
Reference in New Issue
Block a user