Meteor 2 Scripting Functions
Physics
float getMass(int objectID)
Get the mass of an object in KG.
float playerMass = getMass(PLAYER_OBJECT);
print("Player mass is " + playerMass + "KG");
void setMass(int objectID, float mass)
Set the mass of an object in KG.
setMass(PLAYER_OBJECT, 1000);
Set mass to 0 make object static (cannot be moved).
vector2 getLinearVelocity(int objectID)
Get the linear velocity of an object in m/s.
print(getLinearVelocity(PLAYER_OBJECT));
float getAngularVelocity(int objectID)
Get the angular velocity of an object in radians.
print(getAngularVelocity(PLAYER_OBJECT));
bool getKinematic(int objectID)
Get the kinematic status of an object.
if (getKinematic(PLAYER_OBJECT))
{
print("Player is kinematic");
}
else
{
print("Player is not kinematic");
}
void setKinematic(int objectID, bool kinematic)
Set the kinematic status of an object.
setKinematic(PLAYER_OBJECT, true);
Kinematic objects cannot be affected by forces, and cannot collide with static or other kinematic objects.
void applyForce(int objectID, vector2 force)
Apply a linear force to the centre of an object.
applyForce(PLAYER_OBJECT, vector2(10000,10000));
void applyImpulse(int objectID, vector2 impulse)
Apply a linear impulse to the centre of an object.
applyImpulse(PLAYER_OBJECT, vector2(20000,20000));
void applyAngularImpulse(int objectID, float impulse)
Apply an angular impulse to an object.
applyAngularImpulse(PLAYER_OBJECT, 10000);
void setCollidesWith(int object1ID, int object2ID, bool collides)
Set if an object can collide with another object.
setCollidesWith(PLAYER_OBJECT, 0, false);
Index