Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualMedo3337

Posted 17 May 2013 - 03:34 AM

I'm confused.

 

emission is a Vector3, emission.z is a float.

 

If I do the following, the program will not compile:

D3DXVec3Normalize(emission.z+offset*emission.randomness);

 

However, I tried doing it using the way I have in my engine, it could be the same way as your way:

void generateNewParticle()
{
    // Code to generate a new particle here...
    D3DXVECTOR3 randVec = GetRandomVec();
    particle.velocity += randVec * 4.0f;
}

 

D3DXVECTOR3 GetRandomVec()
{
    D3DXVECTOR3 vVector;
    vVector.z = getRandMinMax( -1.0f, 1.0f );
    float radius = (float)sqrt(1 - vVector.z * vVector.z);
    float t = getRandMinMax( -D3DX_PI, D3DX_PI );
    vVector.x = (float)cosf(t) * radius;
    vVector.y = (float)sinf(t) * radius;
    return vVector;
}

 

Althought it works, I have slight problems at the particles generation point, the particles are not looking at the moving direction when generated:

[attachment=15766:problem.png]


#6Medo3337

Posted 17 May 2013 - 03:16 AM

I'm confused.

 

emission is a Vector3, emission.z is a float.

 

If I do the following, the program will not compile:

D3DXVec3Normalize(emission.z+offset*emission.randomness);

 

However, I tried doing it using the way I have in my engine, it could be the same way as your way:

void generateNewParticle()
{
    // Code to generate a new particle here...
    D3DXVECTOR3 randVec = GetRandomVec();
    particle.velocity += randVec * 4.0f;
}

 

D3DXVECTOR3 GetRandomVec()
{
    D3DXVECTOR3 vVector;
    vVector.z = getRandMinMax( -1.0f, 1.0f );
    float radius = (float)sqrt(1 - vVector.z * vVector.z);
    float t = getRandMinMax( -D3DX_PI, D3DX_PI );
    vVector.x = (float)cosf(t) * radius;
    vVector.y = (float)sinf(t) * radius;
    return vVector;
}

 

Althought it works, I have slight problems at the particles generation point, the particle is not look at the moving direction when generated:

[attachment=15766:problem.png]


#5Medo3337

Posted 17 May 2013 - 03:12 AM

I'm confused.

 

emission is a Vector3, emission.z is a float.

 

If I do the following, the program will not compile:

D3DXVec3Normalize(emission.z+offset*emission.randomness);

 

However, I tried doing it using the way I have in my engine, it could be the same way as your way:

void generateNewParticle()
{
    // Code to generate a new particle here...
    D3DXVECTOR3 randVec = GetRandomVec();
    particle.velocity += randVec * 4.0f;
}

 

D3DXVECTOR3 GetRandomVec()
{
    D3DXVECTOR3 vVector;
    vVector.z = getRandMinMax( -1.0f, 1.0f );
    float radius = (float)sqrt(1 - vVector.z * vVector.z);
    float t = getRandMinMax( -D3DX_PI, D3DX_PI );
    vVector.x = (float)cosf(t) * radius;
    vVector.y = (float)sinf(t) * radius;
    return vVector;
}

 

Althought it works, I have slight problems at the particles generation point, the particle is not look at the moving direction when generated:

[attachment=15765:problem.png]


#4Medo3337

Posted 17 May 2013 - 03:12 AM

I'm confused.

 

emission is a Vector3, emission.z is a float.

 

If I do the following, the program will not compile:

D3DXVec3Normalize(emission.z+offset*emission.randomness);

 

 

 

However, I tried doing it using the way I have in my engine, it could be the same way as your way:

 

 

void generateNewParticle()
{
    // Code to generate a new particle here...
    D3DXVECTOR3 randVec = GetRandomVec();
    particle.velocity += randVec * 4.0f;
}

 

 

D3DXVECTOR3 GetRandomVec()
{
    D3DXVECTOR3 vVector;
    vVector.z = getRandMinMax( -1.0f, 1.0f );
    float radius = (float)sqrt(1 - vVector.z * vVector.z);
    float t = getRandMinMax( -D3DX_PI, D3DX_PI );
    vVector.x = (float)cosf(t) * radius;
    vVector.y = (float)sinf(t) * radius;
    return vVector;
}

Althought it works, I have slight problems at the particles generation point, the particle is not look at the moving direction when generated:

[attachment=15765:problem.png]


#3Medo3337

Posted 17 May 2013 - 03:03 AM

I'm confused.

 

emission is a Vector3, emission.z is a float.

 

If I do the following, the program will not compile:

D3DXVec3Normalize(emission.z+offset*emission.randomness);

 

 

 

However, I tried doing it using the way I have in my engine, it could be the same way as your way:

 

// When generating a new particle
D3DXVECTOR3 randVec = GetRandomVec();
particle.velocity += randVec * 4.0f;

D3DXVECTOR3 GetRandomVec()
{
    D3DXVECTOR3 vVector;
    vVector.z = GetRandomMinMax( -1.0f, 1.0f );
    float radius = (float)sqrt(1 - vVector.z * vVector.z);
    float t = getRandMinMax( -D3DX_PI, D3DX_PI );
    vVector.x = (float)cosf(t) * radius;
    vVector.y = (float)sinf(t) * radius;
    return vVector;
}

Althought it works, I have slight problems at the particles generation point, the particle is not look at the moving direction when generated:

[attachment=15765:problem.png]


#2Medo3337

Posted 17 May 2013 - 03:02 AM

I'm confused.

 

emission is a Vector3, emission.z is a float.

 

If I do the following, the program will not compile:

D3DXVec3Normalize(emission.z+offset*emission.randomness);

 

 

 

However, I tried doing it using the way I have in my engine, it could be the same way as your way:

 

// When generating a new particle
D3DXVECTOR3 randVec = GetRandomVec();
particle.velocity += randVec * 4.0f;

D3DXVECTOR3 Emitter::GetRandomVector()
{
    D3DXVECTOR3 vVector;
    vVector.z = GetRandomMinMax( -1.0f, 1.0f );
    float radius = (float)sqrt(1 - vVector.z * vVector.z);
    float t = getRandMinMax( -D3DX_PI, D3DX_PI );
    vVector.x = (float)cosf(t) * radius;
    vVector.y = (float)sinf(t) * radius;


    return vVector;
}

Althought it works, I have slight problems at the particles generation point, the particle is not look at the moving direction when generated:

[attachment=15765:problem.png]


PARTNERS