pseudo z axis on 2d scaling
Posted: January 2nd, 2018, 7:59 pm
Hey folks, I am working on a particle emitter and i want to do a z axis scaling where i get a random z value between - 1 and 1. I want to scale the positive from 1 to 2 or n size and negative from 1 to near 0.
Particle update. I diffuse transparency by life / lifespan which gives me a value between 0 and 1.
I should be able to use this to get from 1 to 0 and 1 to 2 ?.
What i am trying to achieve is a pseudo 3d look
any suggestions ?
Particle update. I diffuse transparency by life / lifespan which gives me a value between 0 and 1.
I should be able to use this to get from 1 to 0 and 1 to 2 ?.
What i am trying to achieve is a pseudo 3d look
Code: Select all
void Particle::Update(const float & dt)
{
if (!done)
{
if ((life -= dt) > 0.0f)
{
if (diffuse)
{
Get<Animation>().SetTransparency(life / lifeSpan);
}
Get<Transform>().velocity.y += gravity;
Get<Transform>().Update(dt);
if (doRotate)
{
Vec2f v = Get<Transform>().velocity;
Get<Transform>().rotation_angle = v.Normalize().Angle();
Get<Transform>().Rotate();
}
/// here
Vec2f scale = { Zscaler,Zscaler };
scale.Normalize();
Get<Transform>().Scale({ scale.x + (life / lifeSpan),scale.y + (life / lifeSpan) });
}
else
{
done = true;
Get<Transform>().Scale({ 1.0f,1.0f });
}
}
}