Muzzle flash positioning problem
Posted: Mon Aug 14, 2006 11:36 am
Ok.. This is a n00b question and may be asked many times. Still I have spent with search many hours with no succeed. So I finally gave up and made this topic..
Let´s see... The problem is this: I´m using ILightSceneNode to create a muzzle flash. I have attach one billboardSceneNode to light´s child. So, the billboard (flame-image) and the light should be in the same position. Then I create an own camera (not FPSCameraNode) with my own movement and rotating methods. Then I attach the ILightSceneNode (which I made before) to camera´s child node and moved it a little bit forward. Now the light should move exactly same as the camera, right?
Now I turn the muzzle flash "on". When I move the camera, the muzzle flash image is always in the correct position. Everything is ok.
PROBLEM:
Now I´m going to make the shooting. If mouse button is down and an interval (reload-variable) is 0, the gun will shoot. I check this once per frame: if shooting is happened, I´ll make the muzzle flash visible. If not, I´ll make it invisible. THE PROBLEM IS THAT I have noticed that now the muzzle flash is not in right position. I is rendered with ping (meaning that if I turn or move my camera when I´m shooting, the muzzle flash appears in the location where my gun was on the previous frame)...
Here is my frame constuction:
I have tried everything but it doesn´t work properly. Could you tell me, what I have done wrong? Or is there another, better, way to make muzzle flash? Thank you.
I apologize my bad English.
Let´s see... The problem is this: I´m using ILightSceneNode to create a muzzle flash. I have attach one billboardSceneNode to light´s child. So, the billboard (flame-image) and the light should be in the same position. Then I create an own camera (not FPSCameraNode) with my own movement and rotating methods. Then I attach the ILightSceneNode (which I made before) to camera´s child node and moved it a little bit forward. Now the light should move exactly same as the camera, right?
Now I turn the muzzle flash "on". When I move the camera, the muzzle flash image is always in the correct position. Everything is ok.
PROBLEM:
Now I´m going to make the shooting. If mouse button is down and an interval (reload-variable) is 0, the gun will shoot. I check this once per frame: if shooting is happened, I´ll make the muzzle flash visible. If not, I´ll make it invisible. THE PROBLEM IS THAT I have noticed that now the muzzle flash is not in right position. I is rendered with ping (meaning that if I turn or move my camera when I´m shooting, the muzzle flash appears in the location where my gun was on the previous frame)...
Here is my frame constuction:
Code: Select all
// start scene
// move the camera
// set the visibly of muzzle flash
smgr->drawAll();
// end scene
I apologize my bad English.