GetAcceleration

This function returns the acceleration value of released particles.

Syntax

Returns

Returns a Vec3 containing the set acceleration of released particles.

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, -3);
Light* light = DirectionalLight::Create();
light->SetRotation(35, 35, 0);

//Create an emitter
Emitter* emitter = Emitter::Create(100);

float acceleration = -0.5;
emitter->SetAcceleration(0, acceleration, 0);

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

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

if (window->KeyDown(Key::Up))
{
acceleration += .1;
emitter->SetAcceleration(0, acceleration, 0);
}
else if (window->KeyDown(Key::Down))
{
acceleration -= .1;
emitter->SetAcceleration(0, acceleration, 0);
}

context->SetBlendMode(Blend::Alpha);
context->DrawText("Current Y-axis Acceleration: " + String(emitter->GetAcceleration().y), 2, 2);
context->SetBlendMode(Blend::Solid);

context->Sync();
}
}