Questions about workings of fireball in techdemo

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Domarius
Posts: 178
Joined: Thu Mar 11, 2004 9:51 am
Location: Brisbane, QLD, Australia

Questions about workings of fireball in techdemo

Post 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)?
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post 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
Last edited by disanti on Tue Feb 22, 2011 8:04 am, edited 1 time in total.
Domarius
Posts: 178
Joined: Thu Mar 11, 2004 9:51 am
Location: Brisbane, QLD, Australia

Post 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?
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

I mean to check the distance from the whole fire, not each fireball. :P

Sorry for the confusion.
________
Brevis
Last edited by disanti on Tue Feb 22, 2011 8:04 am, edited 1 time in total.
Domarius
Posts: 178
Joined: Thu Mar 11, 2004 9:51 am
Location: Brisbane, QLD, Australia

Post 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.
Post Reply