GetRotationSpeed

This function gets the rotation speed in degrees per second of released particles.

Syntax

Returns

This function returns a float containing the particles rotation speed in degrees per second.

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->Move(0, 0, -3);

float rotationspeed = 90;

//Create an emitter
Emitter* emitter = Emitter::Create(500);
Material* material = Material::Load("Materials/Effects/spark.mat");
if (material)
{
emitter->SetMaterial(material);
material->Release();
}

emitter->SetRotationSpeed(rotationspeed);
emitter->SetVelocity(0, 0, 0, 0); //set base velocity to 0

while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;

Leadwerks::Leadwerks::Time::Update();
world->Update();
world->Render();

if (window->KeyDown(Key::Up))
{
++rotationspeed;
emitter->SetRotationSpeed(rotationspeed);
}
else if (window->KeyDown(Key::Down) && rotationspeed > 0.0)
{
--rotationspeed;
emitter->SetRotationSpeed(rotationspeed);
}

context->SetBlendMode(Blend::Alpha);
context->DrawText("Rotation speed: " + String(emitter->GetRotationSpeed()) + " degrees per second.", 2, 2);
context->SetBlendMode(Blend::Solid);

context->Sync();
}
}