SetFacingDirection
This function manually sets a direction that all particles will face.
Syntax
- void SetFacingDirection(float x, float y, float z)
Remarks
The most common application of this function is to draw particles on the ground facing up. Make sure to change the view mode to manual facing direction SetViewMode
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);
//Create an emitter
Emitter* emitter = Emitter::Create(1000);
emitter->SetViewMode(2); //set the view mode to manual facing direction
emitter->SetFacingDirection(0, 1, 0); //set particles to always face up
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("facing direction: " + (emitter->GetFacingDirection()).ToString(), 2, 2);
context->SetBlendMode(Blend::Solid);
context->Sync();
}
}