Change collision body position in Bullet Physics Hello World project

  • Change collision body position in Bullet Physics Hello World project sebap123

    I have got stupid and annoying problem in my app. I am using bullet physics and I've started with hello world example on wiki:

    There is someting like this:

    btDefaultMotionState* fallMotionState =
                new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,50,0)));

    What is described as set object 50m above something. So I can change the height but nothing more. I can't move it left, right - anything. Also when I set 0 everywhere ( I mean in btVector3) the object is jumping up rather than falling down or better stay still.

    Can someone help me with that?

    Also are there any materials except those on bullets page where are some tutorials or something?


    The main thing which I want to achive is to move my object for example left not only top or bottom.

    Hope It will help in understanding.

  • The btVector3 class should let you move the object sideways by changing the first or third (X and Z) parameters. The tutorial assumes that you understand vector math.

    Also, when you set 0 in all btVector3's, that makes the sphere intersect the plane halfway through, because they are both in the origin. This means a collision is already happening during initialization. That's probably why the sphere object is jumping up, because it has responded to the collision.

    Setting up rigid bodies with a finite mass in a way that they're alrady intersect each other during initialization can have unexpected results in their movement. Usually, the only rigid bodies that can overlap without moving are the ones with "infinite" mass, and these are usually for static scenery objects.

c++ bullet-physics
Related questions and answers
  • I have been playing around with Ogre3d and trying to integrate bullet physics. I have previously somewhat successfully got this functionality working with irrlicht and bullet and I am trying to base... *) (node)); // Add it to the physics world World->addRigidBody(RigidBody); Objects.push_back(RigidBody); m_pNumEntities++; // End Physics } I then have a method to create a cube and give it rigid body... every frame to handle input and render etc I call an UpdatePhysics method to update the physics simulation. void GameState::UpdatePhysics(unsigned int TDeltaTime) { World->stepSimulation(TDeltaTime

  • I have got some problem in my OpenGL game. I am using bullet physics and I want to achive quite simple effect - I want one object (a sphere) to roll and hit another (box) which will fall down. I... there are about 20 degrees left to the ground. It isn't stoping on a ball because the speed is so high that it is throw away and after a while it "meets" ball This is my code for objects (including floor) initialization: dynamicsWorld->setGravity(btVector3(0,-10,0)); ballShape = new btSphereShape(1); fallMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3

  • Right now im working on my c++ game, and im having alot of trouble using GLM and Bullet Physics to create my world correctly. The main problem is that when i export my physics with Blenderv2.57, and export my models for GLM, the models never line up with the physics correctly... Im wondering if there are any model loaders that would be good to use with Bullet Physics, and I can export the vertices,texture coords, etc. from Blender to be loaded and used as btTriangleMeshes.. I managed to make a btBvhTriangleMesh with my GLM model, but I think its falling, or my character is not picking

  • I have got some problem implementing bullet physics into my opengl game. The thing is that it doesn't want to update my translatef value continously but only at the end. The code for bullet looks... is that it shows correct value in this function's printf but translation is called only at the beginning I mean I can only see the last state. Can anyone help me, please? ...,-10,0)); ballShape = new btSphereShape(1); pinShape = new btCylinderShape(btVector3(1,1,1)); pinShape->setMargin(0.04); fallMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1

  • different objects in my game: plane, obstacle, player, bullet and I designed them like this: class Player : public GlObject{ private: std::string name; public: Player(); Bullet fire() const; //this method is unique to the class player void generate_mesh(); } Now in the game engine I want to have a general object list where I can check for example for collision, move objects, and so... the polygons to the rendering engine I designed my objects like this: class GlObject{ private: idEnum ObjId; //other identifiers public: void move_obj(); //the movements are the same

  • I'm creating a component-based game object system. Some tips: GameObject is simply a list of Components. There are GameSubsystems. For example, rendering, physics etc. Each GameSubsystem contains... a decision which Components to register (and how to organize them). For example, GameSubsystemRender can register Renderable Components. pro. Components know nothing about how they are used. Low coupling. A. We can add new GameSubsystem. For example, let's add GameSubsystemTitles that registers all ComponentTitle and guarantees that every title is unique and provides interface to quering objects

  • over-thinking it. If anyone thinks they can help, please take a look at the code below and help me try to improve on this if you can. I would like to refrain from using a library to handle this (as I want to learn on my own) or the something like the SAT (Separating Axis Theorem) if at all possible. Thank you in advance for your help! void world1Level1CollisionDetection() { for(int i; i < blocks... detection. Up is negative y and down is positive y, as it is in most games. Hopefully I have provided enough information for someone to help me successfully. If there is something I left out that might

  • doesn't change or gets changed back to 0 somehow. When putting a stop in my msVS++ it works perfectly... and when holding F5 (shortcut for "continue") it partly works but numb_coll still gets set to 0...Alright so i'm making a vertical side scroller where you are an '8' character traveling downward while avoiding my randomly generated walls (the "generation" function) on the left and right sides of the screen, and made of 'X's. you can collide with this wall 4 times before losing. When you collide with the wall you can no longer move, and are basically are stuck in that column of the screen

  • wrong in my frame buffer set up code, or elsewhere. But I can't see what. The FBO is set up through the following function: unsigned int fbo_id; unsigned int depth_buffer; int m_FBOWidth, m_FBOHeight... transformation has occurred somewhere. Which doesn't make sense as the object renders fine when not using my frame buffer (see bottom of post). The current result is such: Current result; glBindFramebuffer(GL_FRAMEBUFFER, 0); } Here is my drawing box code, which just takes a transformation matrix and calls the appropriate functions. The current values of P is a projection matrix

Data information