Open Dynamics Engine (ODE) support for custom bodies - opengl

The Open Dynamics Engine (ODE) supports creation of rigid bodies like sphere, capsule, box etc. How can we create custom made bodies like a cloud, or a tree? I want to know if there is a way to get a partial sphere (may be a hemisphere) and then club it with a capsule so that it can behave as a custom made body?

Related

3D Object Detection & Tracking using PCL

I have a task where i am asked to track parcels(carton boxes) of different dimensions moving on a conveyor
I am using Asus Xtion pro camera and also i have been asked to use Point cloud data to detect & track the object on the conveyor
I have read so many model-based methods where we need to create a model of the object to be detected and then we perform keypoints extraction,feature mapping and so many other concepts between the scene and the model.
Since i am using Boxes of different dimensions, i definitely need a model of each of them to match with the scene.
My question : Can i have one common point cloud model of a box of some dimension and compare it with any box that comes under the view of a camera? I meant can i have one scalable model to compare with box of any dimension? is it possible?
My chief doesn't want the project to be dependent on many models for detection and tracking. One common model which is scalable or parameterized should do the trick it seems.
Thanks in advance

Cocos2d/Box2d. How to generate a physics body from a tilemap .tmx?

I am new to game development.
What I'm trying to do is load the .tmx tilemap I've created from Tiled to my game as a physics body(ies), I'm using C++ and Boxd2. My tilemaps show only the tiles I want to be collideable, like the floor and some platforms.
It's important to note that i'm programming for windows and all documentation I found were about IOS or for an older version, some functions like b2BodyDef bodyDef doesn't seem to work.
I am currently doing what you are describing in my latest game, the only difference being that I use cocostudio to build everything in my game, including my maps. The reason I did this was so that I can have control over everything I needed, I use pre-defined naming conventions to indicate physical edges which I then read up and determine its dimensions and construct my edge bodies.
High-Level overview
Before continuing here are the assumptions I am making about your .tmx tilemap. You have unique identifiers for the objects you would like to create as a physical object
(something in it's name that you can use to pull it out and inspect it).
Read in the .tmx file and give it to your fileParser.
Get all the "Nodes", "Sprites" that have your physical body identifier in it.
Since you are using a tile map I'm assuming that all your collision areas wil be square.
Give the list of nodes to your PhysicsBodyFactory and use the following code to construct the bodies you require.
pseudo-ish code below
auto tileNode = listOfNodes.at(nodeIndex);
b2BodyDef tileBodyDef;
tileBodyDef.type = b2_staticBody;
tileBodyDef.position.Set(tileNode->getPositionX() / Pixel_To_Meter_Ratio,
tileNode->getPositionY()/ Pixel_To_Meter_Ratio);
auto b2PolygonShape tileShape;
tileShape.SetAsBox(tileNode->getBoundingBox().size.width / Pixel_To_Meter_Ratio,
tileNode->getBoundingBox().size.height / Pixel_To_Meter_Ratio);
auto tileBody = physicsWorld->CreateBody(tileBodyDef);
// This can be used later on when you want to have different reactions for different collisions.
tileBody->SetUserData("CollidableTile");
This will create and place these object in your physics world, allowing other bodies in there to collide with it. If your player has its own body in the world, the basic collision will be handled for you.
I am writing a blog post on using cocostudio as more than a UI tool, which will cover this exactly. I hope this helps, please let me know if this solution is what you are looking for.

3D collision detection with MatGeoLib?

I am writing a plug-in in C++ for some dedicated server software which hosts servers for a game.
I looked around for 3D Collision libraries but it's really hard to find any with examples, but I decided to use MathGeoLib because it looks promising - but it lacks examples and I am unable to find any.
So my question is: How would I define a sphere and a cube, a line (Point+direction) and then get the Position XYZ of the first collision which the line encounters?
The documentation only shows the classes and which methods they have. But nothing show how to start using MathGeoLib. Are there any tutorials which are not findable on google?
Background information on my project:
I am making a collision detector for San Andreas Multiplayer, the server has no information whatsover on the game world so I decided to extract the collision files and object placement files and convert them to a usable format for my plug-in.
The objects have a position XYZ and quaternion rotation XYZW and the collision files, well, have lots of stuff in them [a project member is writing a parser for those .col files for the project].
The project goals are to provide a mechanism to determine the Z position based on the XY position and to provide a ray-tracer which tells you where a line (StartPos,EndPos) intersects (hit XYZ) in the game world.
This is why I need to know how to accomplish this with MathGeoLib. I'm going to load all the object collisions into one world and then execute the ray tracer functions. (Amount of objects is around 30,000 in a 6000x6000x1000 area)
Check out
http://bulletphysics.org/wordpress/
Bullet is an open source physics engine and comes with lots of example code. In particular you want to use the rayTest() method of a dynamics world to cast a ray and return the nearest collision point. To summarize you'll need to; create a dynamics world, load your sphere and cube data into it, and then call rayTest(startPoint, endPoint, resultCallback);
Assuming you haven't used bullet before start with the "hello world" example code to see how you can easily create a dynamics world and add rigid bodies to it.

Can Cocos2D handle these graphic requirements?

I'm wanting to build a game with some simple effects.
I want to add the warping effect that you see in games like geometry wars and geodefence. I know how to implement this effect in OpenGL ES. Would I be able to add this to a Cocos2D created app?
I want to have a 3D model that only moves on a 2D plane. It may rotate. First, can I add OpenGL shading to the model? Second, can I have Box2D physics applied to it like it was a 2D sprite?
That's about it. Those are the main functionality I'm hoping I can add to a Cocos2D application and am trying to figure out if I can before I spend a lot of time learning how to use the game engine.
1) Yes, you can intermix Cocos2D and OpenGL ES together - you can override the CCNode's "draw" method and do just about anything you'd like in there (such as rotating, scaling, etc in OpenGL with the texture).
2) You can add the model, and you can shade the model - yes. If you create the body fixtures for the model from Box2D, but treat the Model as if it were a '2d sprite' (has set width/height) - yes, you can use Box2D - but understand that it will only react within the 2D Physics World, and won't have any depth applied to it.
It should be noted though, that though these are possible, you will still need to implement the code to do so on your own.

Scene graph implementation for Papervision?

I'm trying to use Papervision for Flash, for this project of mine, which involves a 3D model of a mechanical frame, consisting of several connected parts. Movement of one of the parts results in a corresponding change in orientation and position of other parts of the frame.
My understanding is that using a scene graph to handle this kind of linked movement would be the ideal way to go, at least, if I were to implement in one of the more established 3D development options, like OpenGL or DirectX.
My question is, is there an existing scene graph implementation for Papervision? Or, an alternative way to generate the required 3D motion?
Thank!
I thought Papervision is basically a Flash-based 3D rendering engine, therefore should contain its own scene graph.
See org.papervision3d.scenes.Scene3D in the API.
And see this article for a lengthier explanation of the various objects in Papervision. One thing you can do is google for articles with the key objects in P3D, such as EngineManager, Viewport3D, BasicRenderEngine, Scene3D and Camera3D.
As for "generating the motion", it depends on what you are trying to achieve exactly. Either you code that up and alter the scene yourself, or use a third-party library like a physics library so as to not have to code all that up yourself.
You can honestly build one in the time it would take you to search for one:
Create a class called Node with a virtual method Render(matrix:Matrix), which holds an array of child nodes.
Create a subclass of Node called TransformNode which takes a reference to a matrix.
Create a subclass of Node called ModelNode which takes a reference to a model.
The Render method of TransformNode multiplies the incoming matrix with its own, then calls the render method of its children with the resulting matrix.
The Render method of ModelNode sends its model off to the renderer at the location specified by the incoming matrix.
That's it. You can enhance things further with a BoundsNode that doesn't call its children if it's bounding shape is not visible in the viewing frustum.