I am getting better with C++ collision. However something I can not find information on though is creating Convex collision using C++. Is it doable? Can Convex collision be created through C++ using Visual Studio? I can not find information about this anywhere.
Weird, I usually state my questions better then this. I edited the question, it should make sense now. Essentially what I am trying to do is create Convex collision using C++ in a program like Visual Studio. I can do this in the editor and have done so many times. However I am trying to keep as much as I can to code. Can Convex collision be created using C++? And if so, how?
So, all of the collision code is handled by the physics engine - that is, you don’t really have to do anything yourself other than setup the properties for collision channels etc, and bind your own functions to the collision event delegates. A good example would be in the ShooterGame example, the projectile class has two functions ‘OnStop’ and ‘OnOverlap’ which it has bound to the collision sphere at it’s root. That way it can do custom behavior when it has a collision with something.
In terms of tracing against the polygons of a mesh, most collision sweeps have the bool ‘bTraceComplex’, which tells the object to use the polygon surface as a collision surface. Again, check the ShooterGame example - all of this is in use there. Hope that helps!
Thank you. I can definitely see how this works for a sphere. However the objects that I am trying to set up convex collision on are much more complicated then that, using a box or a sphere will not help for them. One object for example is a spiral stair case. So how would I set up convex collision for an object like that?
I did not see bTraceComplex in the Shooter Game unless you are talking about a different game. Do you know if there is any documentation anywhere about collision sweeps? I can not find any information at all any where. I am noticing that this is really the biggest issue unreal engine faces and I have seen a lot of other users say the same thing, they do not document things very well. Thank you again still.
Are you trying to CREATE convex collision programmatically in C++? Or just query against it? Assuming your object has the collision authored in some other tool (e.g. Maya), PhysX should just handle all this for you. If you want to do a sweep against the complex collision via code you can do what TheJamsh said, bTraceComplex is a parameter in FCollisionQueryParams that you can pass to any of the Sweep* functions in World.h.
If you want to programmatically create convex collision, that’s probably a bit more tricky.
I am going to say thank you again to those who have responded. I have another question though. Some of this is likely me simply misunderstanding some things. So here it goes…
When I create a mesh in a program like 3ds max or Maya, is the collision created along with it? I guess my line of thinking is that the object that you create in a 3d modeling program is one thing and the collision is something you apply to it separately. Is that not the case?