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)?
Questions about workings of fireball in techdemo
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
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.
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.
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
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'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?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.
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
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?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)
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.
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.