Jump to content
ErhanK

Lighting Problem

Recommended Posts

When the bullet I fired hits the wall, smoke comes out. Such a change in lights occurs throughout the lifetime of the smoke. Is this a bug or am I making a mistake?

 

 

Here is my code

{
  	//initial codes up here
	//Smoke emitter
	smokeMaterial = Material::Load("Materials/Effects/smoke.mat");
	hitEmitter[1] = Emitter::Create();
	hitEmitter[1]->SetCollisionType(0);
	hitEmitter[1]->SetColor(1, 1, 1, 0.25);
	hitEmitter[1]->SetMaterial(smokeMaterial);
	hitEmitter[1]->SetEmissionVolume(0.05, 0.05, 0.05);
	hitEmitter[1]->SetVelocity(0.5, 0.5, 0.5, 1);
	hitEmitter[1]->SetParticleCount(18);
	hitEmitter[1]->SetReleaseQuantity(18);
	hitEmitter[1]->SetMaxScale(4);
	hitEmitter[1]->SetDuration(1500);
	hitEmitter[1]->AddScaleControlPoint(0, 0.7);
	hitEmitter[1]->AddScaleControlPoint(1, 1);
	hitEmitter[1]->SetRotationSpeed(8);
	hitEmitter[1]->SetAcceleration(0,-1.2,0);
	hitEmitter[1]->Hide();

	hitEmitter[0]->SetParent(this->entity);
	hitEmitter[0]->SetPosition(0.0f, 0.0f, 0.0f, false);
	hitEmitter[0]->SetShadowMode(0);
	hitEmitter[0]->Show();
	hitEmitter[0]->SetLoopMode(false, true);

	lifeTime = 12000;
	fadeTime = 4000;
	fadeStart = Time::GetCurrent() + lifeTime - fadeTime;
}

void BulletHit::UpdateWorld()
{
	int currentTime = Time::GetCurrent();
	if (currentTime > fadeStart) {
		float alpha = 1.0f - (currentTime - fadeStart) / fadeTime;
		if (alpha <= 0) {
			this->entity->Release();
		}	
	}
			
}
	

 

Share this post


Link to post

Very strange. Can you post the contents of smoke.mat?

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...