Page 1 of 1

Questions about workings of fireball in techdemo

Posted: Fri Apr 02, 2004 9:40 am
by Domarius
In the tech demo, in CDemo.cpp, there is a 'struct' called SParticleImpact. I worked out that this is what is instantiated to make a "shoot" fireball.

These variables are created inside it.
core::vector3df pos;
core::vector3df outVector;
I'm assuming they are to help make the ball travel.

What I want to know is; how are they used?

Also, where is the fireball destroyed?? I can see where it is added to the array; Impacts.push_back(imp); but when is it removed??

Also, what is the syntax to iterate through the array to test each ball if it is overlapping another object (so you can shoot things)?

Posted: Fri Apr 02, 2004 2:03 pm
by disanti
irr::core::vector3df is nothing but a position. It holds X, Y, Z and some functions.

I don't know where it ends as I havn't looked at the techdemo.

I wouldn't waste the processor with testing each fireball. You should just test the distance between the object that can be in the fire, and the fire. This way it won't run slow.

3D Distance formula (there is a function in vector3df that can find distances but I prefer this)
Square Root((x1 - x2)^2 + (y1-y2)^2 + (z1-z2)^2)
There are a few other methods on GameDev.Net that are faster but not as accurate.

Hope this helps!
________
Extreme vaporizer

Posted: Sat Apr 03, 2004 1:57 am
by Domarius
Thanks disanti.

I know what vector3df does. I was wondering what the SParticleImpact struct is doing with it. I think I'll go to the advanced forum with that one.
I wouldn't waste the processor with testing each fireball. You should just test the distance between the object that can be in the fire, and the fire. This way it won't run slow.
I'm not sure what you mean. I think you were telling me not to test every fireball against every moving object (of course I mean only the ones that should be hit), but then you said to test the distance between the object that can be hit, and the fireball. But wouldn't I have to test every object's distance from every fireball anyway?
Maybe see my post where I already asked this question and got a reply so you can see where I'm coming from. http://irrlicht.sourceforge.net/phpBB2/ ... sion#10296
3D Distance formula (there is a function in vector3df that can find distances but I prefer this)
Square Root((x1 - x2)^2 + (y1-y2)^2 + (z1-z2)^2)
Does anyone know how I can be sure that checking the distance (using that formula) would be faster than detecting an overlap between the position of the fireball, and the aabb of the moving object?

Posted: Sat Apr 03, 2004 3:29 am
by disanti
I mean to check the distance from the whole fire, not each fireball. :P

Sorry for the confusion.
________
Brevis

Posted: Tue Apr 06, 2004 12:40 am
by Domarius
Oh I see what you think I mean now.

I'm talking about the 'fireballs' you shoot out; the 'bullets'.

Not the fireplace with a fire made of lots of particles :)

But I got a good answer to testing for projectile bullet collision in another thread
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=1972

Now I probably just need to take my other questions to the advanced forum.