1
\$\begingroup\$

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: http://bulletphysics.org/mediawiki-1.5.8/index.php/Hello_World

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?

EDIT

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.

\$\endgroup\$
4
  • \$\begingroup\$ I assume you mean to make the object controllable by the player? \$\endgroup\$
    – ChrisC
    Jan 6, 2012 at 21:30
  • \$\begingroup\$ For now it has lower priority, but in fact I would like to. Some of objects yes. Maybe by adding some force - I am making bowling game and I have got my own physics which is quite poor. And this sphere is a prototype for new ball. But as I said now even if I would be able to change position to defined in code would be nice. But I can't \$\endgroup\$
    – sebap123
    Jan 6, 2012 at 21:36
  • \$\begingroup\$ Okay, so you want to apply a linear force. \$\endgroup\$
    – ChrisC
    Jan 6, 2012 at 21:42
  • \$\begingroup\$ I think yes. Can you write something about it - maybe edit your previous answer? And what to do with this axis and ball position? \$\endgroup\$
    – sebap123
    Jan 6, 2012 at 21:45

1 Answer 1

0
\$\begingroup\$

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.

\$\endgroup\$
5
  • \$\begingroup\$ Well, the thing is that I understand the vector math and I've tried to change X or Z axis. In other words I wouldn't write here if I wouldn't check it. So if I try for example 'btVector3(4,1,0)' or 'btVector3(2,0,0)' it doesn't react. \$\endgroup\$
    – sebap123
    Jan 6, 2012 at 21:06
  • \$\begingroup\$ When you change the X or Z (and leave Y at 50m for now) does the sphere no longer respond to gravity? \$\endgroup\$
    – ChrisC
    Jan 6, 2012 at 21:13
  • \$\begingroup\$ When I am changing X or Z axis sphere is responding to gravity. It don't take X or Z values. Simply just like there would be 0 still. \$\endgroup\$
    – sebap123
    Jan 6, 2012 at 21:16
  • \$\begingroup\$ You should edit your question so that your statement is easier to understand, then. I don't know if you are making a distinction between X and Z values, and X and Z axes. \$\endgroup\$
    – ChrisC
    Jan 6, 2012 at 21:24
  • \$\begingroup\$ edited hope it would help \$\endgroup\$
    – sebap123
    Jan 6, 2012 at 21:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .