in-game crashing

Nakate

17-12-2007 19:46:00

Hello everyone. I'm a bit new to dealing with physics libraries and the such, but I've been fighting with this and *seem* to have gotten it installed. However, when I attempt to create a static trimesh, the game crashes, though it compiles fine. This may be due to the lack of documentation, but I'm not entirely sure what needs to be done in the first place. After studying the demo for the past few days I thought I knew, but I guess not yet.

The error in-game occurs when the object is made, and the error is:
Assertion Failed!

Program: ...
File: e:\projects\ogrecvs\branches\eihor...\ogreentity.cpp
Line: 1016

Expression: mSkelAnimVertexData && "Not software skinned or has no shared vertex data!"


What I do to create the trimesh is:
Entity *sceneEntity = mSceneMgr->createEntity( "Map", "planets.mesh" );
OgreBulletCollisions::MeshToShapeConverter *trimeshConverter = new OgreBulletCollisions::MeshToShapeConverter(sceneEntity);
OgreBulletCollisions::TriangleMeshCollisionShape *sceneTriMeshShape = trimeshConverter->createTrimesh();
delete trimeshConverter;
OgreBulletDynamics::RigidBody *sceneRigid = new OgreBulletDynamics::RigidBody("MapRigid", mWorld);
SceneNode *node5 = mSceneMgr->getRootSceneNode()->createChildSceneNode("MapNode", Vector3(0, 0, 0));
node5->attachObject( sceneEntity );
sceneRigid->setStaticShape(node5, sceneTriMeshShape, 0.1f, 0.8f, Vector3(500,100,500));


mWorld is created with:
Vector3 gravityVector = Vector3( 0, -9.810000, 0 );
AxisAlignedBox bounds = AxisAlignedBox( Vector3(-10000, -10000,-10000), Vector3(10000, 10000,10000) );
mWorld = new OgreBulletDynamics::DynamicsWorld (mSceneMgr, bounds, gravityVector);


and I #include:
#include "OgreBulletCollisions.h"
#include "OgreBulletDynamics.h"
#include "OgreBulletDynamicsRigidBody.h"
#include "Utils/OgreBulletCollisionsMeshToShapeConverter.h"
#include "Shapes/OgreBulletCollisionsTrimeshShape.h"


Ogre.log doesn't appear to have any useful information in it. Am I simply forgetting to do something? I've been jumping through hoops to get the game as far as I have, so I can only pray there's a simple solution to this.

As long as I'm here, I'll ask about a few other things on my mind. Is there any way to lock an object's rotation and movement to prevent rolling, pitching, and sliding? For example, if a person is standing on a hill, he can still stand upright without falling over or sliding down the hill (within reason). Yet he can start and stop walking whenever he pleases, so just turning up the friction may not work. Also, if he walks into a low object like a table he won't trip over it (if he's paying attention, anyway). I appreciate any help you can give, and thanks in advance for your time.

Chaster

19-12-2007 06:44:14

Your error seems to be related to your mesh not having vertex weights yet it claims to... That's a problem not related to OgreBullet, but rather your actual model mesh.

To answer your other question regarding character control: yes, you can do this several ways (manually set the orientation of the rigid body so that the character always remains upright, or you can add a constraint to keep him upright, or there is a bullet function to eliminate angular motion, but I can't remember the exact name of it - check in the bullet forums and you will find lots of info)... Be aware that character control is not always as straightforward as one would believe... Once you start diving into the nitty gritty, you will find lots of "gotchas" which you will have to work around.

I highly recommend you search through the bullet forums for answers to your questions as this forum isn't necessarily for teaching basics of physics libraries, but rather the specifics of OgreBullet as an interface to Bullet...

Chaster