nickhardeman / ofxbullet Goto Github PK
View Code? Open in Web Editor NEWBullet Physics Wrapper for Openframeworks
Bullet Physics Wrapper for Openframeworks
Hi there,
Firstly thank you for creating this project. It looks really awesome.
Unfortunately I'm struggling to run any of the examples included with the library, with the exception of the 'emptyExample' project, which runs fine.
When running the SimpleExample, the project builds and runs, but straight away gives this error:
btMatrix3x3.h
Line 360
Thread 1: EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
Googling turns up this forum post...
http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=8514
...But that's as far as I've got. I'm completely stumped by this. Any ideas?
Many thanks,
OF 0.8.4, Xcode 6.1, Mac OS 10.9.5
Hey Nick,
Not sure this is a ofxBullet problem, but I've been trying to use ofxOpenCL + ofxBullet together and I get a runtime crash every time... is there any way to disable Bullet's use of openCL so it only uses the GPU?
Thanks for the addon man, its going to save me weeks of time.
Reza
here is the build transcript:
oF 0.8.0
void ofApp::draw(){
...
ofSetColor(0, 0, 255);
ofDrawSphere(cam.getPosition()+castRay*600, 10);
ofSetColor(255, 100, 200);
ofDrawSphere(rayWorldPos, 10);
// line from origin-zero to castRay pos, it pass through rayWorldPos
ofSetColor(0, 255, 0);
ofSetLineWidth(5);
ofLine(ofVec3f(0), cam.getPosition()+castRay*600);
...
}
///////////////
void ofApp::touchDown(ofTouchEventArgs & touch){
ofxBulletRaycastData data = world.raycastTest(touch.x, touch.y);
if ( data.bHasHit ){
MyBodyInfo* info = (MyBodyInfo*)data.userData;
info->c = ofColor(0, 255, 100);
rayWorldPos = data.rayWorldPos;
}
castRay = cam.screenToWorld( ofVec3f(touch.x, touch.y, 0) );
castRay = castRay - cam.getPosition();
castRay.normalize();
}
something wrong with this?
world->rayTest( rayStart, rayEnd, rayCallback );
I think,
tr.setRotation( btQuaternion(btVector3(a_rot.x(), a_rot.y(), a_rot.z()), a_rot.w()) );
is not quaternion, it is axis-angle representation.
Maybe,
tr.setRotation(btQuaternion(a_rot.x(), a_rot.y(), a_rot.z(), a_rot.w()) );
is correct. Could you please check?
for example.
void ofxBulletCylinder::create( btDiscreteDynamicsWorld* a_world, ofVec3f a_loc, ofQuaternion a_rot, float a_mass, float a_radius, float a_height ) {
btTransform tr = ofGetBtTransformFromVec3f( a_loc );
//tr.setRotation( btQuaternion(btVector3(a_rot.x(), a_rot.y(), a_rot.z()), a_rot.w()) );
tr.setRotation( btQuaternion(a_rot.x(), a_rot.y(), a_rot.z(), a_rot.w()) );
}
Hey,
first of all thanks for your work here. I compiled the bulletlib2.81 without the MultiThreaded and MiniCL parts using codeblocks in windows. I then used the project generator, added ofxBullet, also removed MultiThreaded and MiniCL from search directories and project and compiled an empty project. That worked just fine, just had to change two include paths for glu.h and glut.h. I copied the source from the SimpleExample and tried to run it, but it crashes right on start up. Funny enough: commenting out just the ofxBullet parts in testApp.cpp doesn't change anything. I also had to comment the camera positioning. Using simple of methods like ofSetColor, ofLine, ofBox, ect works just fine though
I think it might not be very ofxBullet specific, but maybe some one has an idea what to try next or how to debug that crash?
thanks in advance!
Bad access in btMatrix3x3.h
breaks on line 360 with bad access EXC_1386_GPFLT.
On oF 0.8.4, Xcode 6.0.1, build for 10.7
I recently was able to get ofxBullet working under vs2012, but the fix I had to make to your code is something that I can't possibly know the implications of just yet. It has to do with aligned types in bt that vc11 just doesn't know how to deal with. Everywhere you use a bt_transform needs to be passed by reference because it is an aligned type. Last time I dealt with this it had to do with containers and MS not really keeping in line with the STL, and basically the compiler doesn't know how to deal with containers of values of aligned types. But once again, I don't know what this would do to the existing code base, as passing by reference is a notorious sleeper agent for bugs. I'll keep testing and seeing what's up, but it looks pretty promising. It's a total hack, but it hasn't unexpectedly broken yet.
Every time after I quit any application using ofBullet I get the following message in the console
**
Assertion failed: (m_constraintRefs.size()==0), function btRigidBody, file /Users/NickHardeman/Desktop/bullet-2.77 2/src/BulletDynamics/Dynamics/btRigidBody.h, line 175.211/src/gcc/libgcc2.c".
sharedlibrary apply-load-rules all
warning: Could not find object file "/Developer/usr/lib/gcc/i686-apple-darwin10/4.0.1/libgcc.a(_eprintf.o)" - no debug information available for "/var/tmp/gcc_40/gcc_40-5494
warning: Could not find object file "/Users/theo/Documents/CODE/__OPENFRAMEWORKS/gitOF/openFrameworks/apps/devApps/macDragDropExample/buildGlutFrameworkHackedWindowLevel10.4/libForeground.a(macx_foreground.o)" - no debug information available for "/Users/mcast/Code/GLUT-ToPost/macx_foreground.m".
**
And also points to the following thread
I don't know what is going on, any ideas?
Any thoughts on upgrade to Bullet3?
transformGL() bug when use ofGLProgrammableRender. ( If use this render, all matrix function will not work( eg. glPushMatrix, glMultMatrix, glTranslate, glRotate )
Like:
//--------------------------------------------------------------
void ofxBulletBaseShape::transformGL() {
btScalar m[16];
ofGetOpenGLMatrixFromRigidBody( getRigidBody(), m );
// not work with ofGLProgrammableRender
// matrix was calculate in shader
//glPushMatrix();
//glMultMatrixf( m );
// I think is better to use oF Matrix function
ofPushMatrix();
ofMultMatrix(ofMatrix4x4(m));
}
//--------------------------------------------------------------
void ofxBulletBaseShape::restoreTramsformGL() {
//glPopMatrix();
ofPopMatrix();
}
I think we should use more oF function. :)
Hi Nick,
i am experimenting some unexpected results when trying this add-on on Android.
Everything worked fine with the old add-on so i guess it might be related with GL ES 2.
when loading models, in an Android context (it works fine in the desktop version), it looks like the physics are not generated from the mesh (and the model has only one --> it's the oflogo.dae). The model is shown but it goes crazy and keeps moving around the 3D space.
Instead the right 3D model, there is an "invisible" object which determines the physics.
I think there might be some issue with these lines because getNumMeshes() used to return 1, and now returns variable values from -1 to 30k:
for (int i = 0; i < 3; i++) {
logos.push_back( new ofxBulletCustomShape() );
startLoc = ofVec3f( ofRandom(-5, 5), ofRandom(0, -hwidth+5), ofRandom(-5, 5) );
if(i == 0) {
for(int i = 0; i < assimpModel.getNumMeshes(); i++) {
logos[i]->addMesh(assimpModel.getMesh(i), scale, true);
}
} else {
logos[i]>init( (btCompoundShape*)logos[0]>getCollisionShape(), logos[0]->getCentroid() );
}
logos[i]->create( world.world, startLoc, startRot, 3. );
logos[i]->add();
}
any ideas?
Hi I'm getting a bunch of errors while trying to compile some of the examples (EventExample in this case):
any idea about the cause?
In file included from /mnt/FILES/CODE/OF/OF_098/addons/ofxBullet/src/ofxBulletWorldRigid.h:14:0, from /mnt/FILES/CODE/OF/OF_098/addons/ofxBullet/src/ofxBullet.h:11, from /mnt/FILES/CODE/OF/OF_098/apps/myApps/EventsExample/src/ofApp.h:4, from /mnt/FILES/CODE/OF/OF_098/apps/myApps/EventsExample/src/main.cpp:2: /mnt/FILES/CODE/OF/OF_098/addons/ofxBullet/src/ofxBulletUtils.h:13:47: error: ‘glm’ has not been declared static btTransform ofGetBtTransformFromVec3f( glm::vec3 a_v ) { ^ /mnt/FILES/CODE/OF/OF_098/addons/ofxBullet/src/ofxBulletUtils.h:13:63: error: expected ‘,’ or ‘;’ before ‘{’ token static btTransform ofGetBtTransformFromVec3f( glm::vec3 a_v ) { ^ /mnt/FILES/CODE/OF/OF_098/addons/ofxBullet/src/ofxBulletUtils.h:34:80: error: ‘glm’ has not been declared gidBody* ofGetBtRigidBodyFromCollisionShape(btCollisionShape* a_cs, glm::vec3 a ^ /mnt/FILES/CODE/OF/OF_098/addons/ofxBullet/src/ofxBulletUtils.h:34:90: error: expected ‘,’ or ‘...’ before ‘a_loc’ fGetBtRigidBodyFromCollisionShape(btCollisionShape* a_cs, glm::vec3 a_loc, floa ^ /mnt/FILES/CODE/OF/OF_098/addons/ofxBullet/src/ofxBulletUtils.h: In function ‘btRigidBody* ofGetBtRigidBodyFromCollisionShape(btCollisionShape*, int)’: /mnt/FILES/CODE/OF/OF_098/addons/ofxBullet/src/ofxBulletUtils.h:35:43: error: ‘a_loc’ was not declared in this scope btTransform tr=ofGetBtTransformFromVec3f(a_loc);
Compiling empty example in Code::Blocks under Debian gives..
../../../../addons/ofxBullet/libs/bullet2.8.1/include/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolverBuffer_DX11.h:19:21: fatal error: windows.h: No such file or directory
#include <windows.h>
Some compile variable for Bullet that is wrong for Linux environment?
I'm having trouble compiling
.../addons/ofxBullet/libs/bullet2.8.1/include/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolverVertexBuffer_DX11.h:22:10: 'windows.h' file not found`
The windows.h
file is not found so I'm thinking the project configuration is off for iOS in XCode6.
Here is what I'm doing :
ofxBullet
into my addons
folderProject Generator
to create a new projectXCode6
hey @NickHardeman,
nice addon man!
i had some errors compiling the ios examples.
found this this to work,
not sure if this is the best solution but it worked for me.
thanks for the great add-on.
is it possible to apply a texture to the bunny in the SoftBodyMeshExample?
it would be great to hear your advice on how to achieve that.
thanks, stephan
drawing all the debug lines in a VBO will greatly increase the performance.
suggested in this stackoverflow post,
http://stackoverflow.com/questions/14008295/how-to-implement-the-btidebugdraw-interface-of-bullet-in-opengl-4-0
OF 0.9.0 will be shipping with libc++ for OSX 32-bit which will require libraries built with libstdc++ to be recompiled in order to link properly. @arturoc said he might be able to help with Bullet.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.