Particle interaction with environment and objects in scene - c++

I've create a ParticleSystem in Ogre so that my object emitt, suppose, a lot of star.
My question is: how can I realize the interaction of this stars with the environment and the objects in the scene too? but more importantly, can I do this issue with ParticleSystem?
Any help will be appreciated!
update
I'm trying to use inside my particle file:
affector DeflectorPlane {
....
}

A DeflectorPlane supports as the name suggests only a single plane of which particles can bounce of (see entry in Ogre manual).
Having particles bounce of arbitrary surfaces involves a lot of heavy collision detection and is therefore a task that is not in the responsibility of a rending but a physics engine, hence Ogre3D has no out-of-the-box support for this requirement.
But there are four different options in terms of already existing Ogre3D physics engine wrappers: Newton, Bullet, PhysX and ODE. Each of the wrappers has its own dedicated section in the Ogre Addons forum with further information and links.

Related

What is the intended way (or a good way) to do collision detection in Qt3D?

I have some 3d objects in a simple Qt3D scene with a camera. It is set up in a few minutes in Qt3D using C++. What is the best way to do collision detection? I am not asking how to do collision detection, but what the best way is to do it in Qt3D.
I changed the question from the best way - to intended way ! This is an entity component system, and the question is related to the architecture of Qt3D that is not that simple to understand in terms of where to add this. KDABs talk about an intended way, ... what is that way??
Added may 15:
I am using C++, not QML.
From comments and answers, it seems to be clear that the intended way is to add collision detection in aspects.
If this is correct, then how can you for example maintain a list of colliding objects in aspects ?? seems impossible to me... hope someone have an idea.
**** Added may 23 ****
Collision detection was included in Qt3D before, many things was taken out, and Qt3D was redesigned. There are many problems with lacking documentation as a result. Please do not reply to this if you do not really know the inner workings of Qt3D, I am not looking for the short answers you can google yourself to, but the deeper understanding, due to the problem with lacking documentation of the new way things work from KDAB.
Qt3D uses an Entity Component System (ECS), and typically in such systems entities are collections of components, and there exist systems that operate over entities based on their contents. Qt3D is no different, your QML scripts define entities and associates components to them, and Qt3D's predefined systems operate over and manipulate them to create the intended user interface experience, this is where most tutorials for Qt3D end, some will continue to mention that there are ways to build on top of the Qt3D.
Qt3D's predefined systems can be complemented with new systems, in Qt3D these systems are called Aspects. To extend Qt3D with new Aspects, for example physics simulation, you have to define a new Aspect that wraps the implementation of the system, and custom components that encapsulate whatever data necessary for the Aspect to operate that can't otherwise be associated with the entity. Once you have this all defined, and registered into the Qt3D context, you just have to populate your entities with the components the system requires and the Aspect will be called to operate over them, causing the implementation to operate over and manipulate them.
Now the remaining question is how to implement a physics (or any entity pairing based) system in an ECS, which has been covered ubiquitously in ECS game designing discussions. Below I've provided slides and blogs from KDAB providing a high velocity crash course in the Qt3D architecture and reasoning behind it, and a tutorial explaining the ins and outs of extending Qt3D with a custom aspect. Good Luck!
Slides:
https://www.qtdeveloperdays.com/sites/default/files/qt3d-in-depth.pdf
Detail:
https://www.kdab.com/overview-qt3d-2-0-part-1/
https://www.kdab.com/overview-qt3d-2-0-part-2/
Tutorial:
https://www.kdab.com/writing-custom-qt-3d-aspect/
https://www.kdab.com/writing-custom-qt-3d-aspect-part-2/
Addendum: Unfortunately, there appears to be a missing 3rd part :(

Basic 3D OpenGL collision detection C++

I'm currently in the process of developing a very basic 3D OpenGL game in C++ as part of a small college project. We don't get a lot of insight from the teachers however, and only very limited documentation, as well as a small timeframe, so I'm kind of a little lost here at the moment.
My game is a tank battle on an orthogonal plane that pretty much looks exactly like the image I sketched below. Each tank (A and B) can be controlled by a different player, and each one can shoot projectiles, which are supposed to influence the other tank's score upon collision.
My question is, what would be the simplest way of effectively implementing collisions for the tanks? (Tank vs tank, tank vs map boundaries and tank vs any kind of parallelepipedic object like the one in the center of the picture - and the same thing but applied to the projectiles shot from the tank turrets).
Ideally, without the need of using an external physics engine, but also accepted if the implementation can be done easily. At the moment, I'm solely using the GLUT library.
Download and integrate Box2D (http://box2d.org) into your project.
Unless your project is to implement a physics engine, then don't bother doing it yourself. Your time will be much better spent learning how to integratate libraries and how proper physics engines work.
You can then easily use a box collider for your tanks, circle for projectiles and 4 lines for your perimeter. You can create callbacks to notify you when a projectile has collided with another tank.
You will have to use forces and torques to move and rotate your tanks, rather than just updating their positions. But you would probably have to do that anyway if you were going to implement the physics yourself.

How to raycast against a physx cloth mesh?

I'm using the PhysX 3.3 SDK in a application and mostly everything is working fine. However, I'm trying to develop a feature that would allow users to click on various actors in the scene and modify their properties.
My approach so far has been to use the PhysX raycast to query the scene and use RaycastHit to return a pointer to the actor. This works fine for rigid bodies, but for cloth actors, the hit is invariably null.
This suggests that PhysX can't raycast against cloth objects, but other than my tests, I haven't seen anything in the docs (or on the interwebs) that say this definitively.
Any thoughts?

Free cross platform 2D graphical game engine

Are there any C/C++ free cross-platform 2D oriented graphical game engines (for isometric game)?
I'm expecting following features from engine:
Window creation
OpenGL context creation and initialization
Resource management
Animated sprites
Particle systems
I've considered OGRE (seems to be 3D oriented), Irrlicht (much more than just graphical engine, and also 3D oriented), SDL (only low-level functions, no resource loading/management).
Could you please advise anything else?
Although it's not a full-featured game engine, SFML might suit your needs. Apart from window and OpenGL context creation it also provides 2D sprite functionality. Sprite animation and particle systems are not available out-of-the box but should be easy enough to implement on top of the existing features. Someone apparently already implemented an OGRE-like particle system in SFML.
SFML is distributed under the zlib/png license, which might or might not meet your definition of "free".

Simple ray collision library (bonus if it loads 3ds and b3d)

I've spent quite some time searching a simple / fast c++ library (Win / Linux) that can answer the two questions 'does this ray crosses any of the triangles?' or 'where is the first intersection, if there are any?'.
It's for my little game I'm writing and will be used to see if a NPC can see a player and also to check if a player can fall all the way to the ground (or not).
The triangles will not move (well, if you can flag a triangle group 'on' / 'off' that would be nice).
I actually found some libraries but only non-continued (or it seems) like OZCollide for example.
Of course there are all those new shiny Physics engines out there but I don't need 99% of what they offer.
A bonus would be if the library can load .3ds an .b3d files and even better if it can be used in a multi threaded environment (creating several instances of the search data).
Thanks all!
Bullet Physics (http://bulletphysics.org/) is a physics library, but it's built in several layers.
Because of this it can be used as just a collision library which is quite efficient at casting rays through a scene.
(You wouldn't be using or be bothered by any of its physics features)
It's available on Windows and Linux, but also on several more platforms and even on game consoles.
The library is proven and used professionally by various game developers.
It does not directly support .3ds files, but it does has a pipeline for getting geometry from various 3D modelling applications converted to the right format Bullet understands.
It might feel overkill to use it because it's a physics library. But that is actually the reason you should be using it.
A physics library is highly reliant on a good collision library, which actually forces the collision library to be of high quality and offer excellent performance.
Well, there seems to be no 'simple & small' library / code out there so I guess the answer might be 'roll your own'.
That is what I did anyway:
a tool that uses Irrlicht to load up my (static) geometry and then save off all (triangle/vertex) data to a file, just 9 floats for each triangle.
Then a collision library that loads up the data into an octree and the c2005 triangle / ray intersection test and it works OK.