GetOmega
This function gets entity's omega (angular velocity), in global or local space.
Syntax
- Vec3 GetOmega(bool global = true)
Parameters
- global: if set to true the omega is returned in global space (relative to the world), otherwise it is returned in local space (relative to the entity).
Returns
Returns the entity omega.
Example
#include "Leadwerks.h"
using namespace Leadwerks;
int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
World* world = World::Create();
Camera* camera = Camera::Create();
camera->SetRotation(35, 0, 0);
camera->Move(0, 0, -5);
Light* light = DirectionalLight::Create();
light->SetRotation(35, 35, 0);
//Create a model
Entity* entity = Model::Box(1, 1, 1);
entity->SetColor(0.0, 0.0, 1.0);
entity->SetMass(1);
entity->SetGravityMode(false);
//Create a shape
Shape* shape = Shape::Box(0, 0, 0, 0, 0, 0, 1, 1, 3);
entity->SetShape(shape);
shape->Release();
//Add some torque
entity->AddTorque(1000, 1000, 1000);
while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;
Leadwerks::Leadwerks::Time::Update();
world->Update();
world->Render();
context->SetBlendMode(Blend::Alpha);
context->DrawText("Omega: " + entity->GetOmega().ToString(), 2, 2);
context->Sync();
}
}