Correct way to move objects around in game

Post Reply
Mars_999
Posts: 25
Joined: Tue Dec 04, 2007 7:48 pm

Correct way to move objects around in game

Post by Mars_999 »

I used PhysX before moving to bullet and they had things called actors that helped move object around.

I don't see actors per se with bullet so what is the correct way to go about moving my players object around the world?

I currently am using applyForce() on my ball to move it around but I don't think that is the correct way to do it...

I want to take user input and dump this into a function and have bullet move the players object around? Is this possible? If not, what is the correct way to go about it...

I need to move my player around, and I would like to move a few objects in various patterns. e.g. circle or triangle patterns.... would the same method of doing this apply to the players movements?

Thanks!

Dave
Mars_999
Posts: 25
Joined: Tue Dec 04, 2007 7:48 pm

Re: Correct way to move objects around in game

Post by Mars_999 »

BUMP???
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: Correct way to move objects around in game

Post by pico »

Hi,

actors are called btRigidBodies in Bullet. Both constructs have almost the same set of functionality.
So applying a force is what you also would do in Physx.

Maybe you refer to CharacterControllers or KinematicBodies? Those can be controlled more directly.

For character controllers check out the bullet demo.

For KinematicBodies you need to toggle the kinematic flag on creation of the rigid body and set the world transform directly.
Maybe you also want to check out the Wiki first.
Mars_999
Posts: 25
Joined: Tue Dec 04, 2007 7:48 pm

Re: Correct way to move objects around in game

Post by Mars_999 »

Hello pico,

Thanks for the info, much appreciated. Helped clear up that issue.

Regarding, btKinematicCharacterController class

///Interaction between btKinematicCharacterController and dynamic rigid bodies needs to be explicity implemented by the user.

I have no clue on what I would need to do or what needs to be done to explicitly to do collision detections. I am assuming I would have to do the whole 9 yards for collision detections of the player vs. all dynamic objects and determine what tests and methods to find out if a collision happened and where? This sounds very very complex and over my head since I am looking for Bullet to take care of all that for now.... I am still learning bullet, let alone physics/collision theories!

Thanks
Mars_999
Posts: 25
Joined: Tue Dec 04, 2007 7:48 pm

Re: Correct way to move objects around in game

Post by Mars_999 »

Bump

Anyone?
thloh85
Posts: 26
Joined: Mon Feb 09, 2009 10:07 am

Re: Correct way to move objects around in game

Post by thloh85 »

No you DON'T have to do collision detection manually for kinematic body, there will be collision by default.
The thing with kinematic body is that when other object hits it (or "pushes" it), this kinematic body will NOT move in anyway, so, if you want your kinematic object to react to those, you'll have to manually do them.

I don't know about kinematic vs kinematic body collision, but my guess is that it will go straight through, and will not collide. I think you'll need to handle that too.

Hope this helps.
Mars_999
Posts: 25
Joined: Tue Dec 04, 2007 7:48 pm

Re: Correct way to move objects around in game

Post by Mars_999 »

THanks for the reply.

So when there is contact do you use a trigger or a callback? I basically just want to know I hit/ran into the object so I can get pts and remove it from the rendering loop.

"I don't know about kinematic vs kinematic body collision, but my guess is that it will go straight through, and will not collide. I think you'll need to handle that too."

Will this still produce an event so I can use a callback or trigger to do what I am looking for?

Thanks
Dave
AlexSilverman
Posts: 141
Joined: Mon Jul 02, 2007 5:12 pm

Re: Correct way to move objects around in game

Post by AlexSilverman »

Mars_999 wrote:Will this still produce an event so I can use a callback or trigger to do what I am looking for?
Static -> static collision is ruled out by the broadphase collision filter I believe. I'm not positive about all of the reprecussions of this, but you could probably explicitly set the collision filters for your object at creation ( by overriding btDynamicsWorld::addRigidBody() ) so that it is tested against other static objects. This will probably give you a bit of a performance hit, but I'd expect it to do the job. I'm not sure if this step would be necessary, but you may want to also derive your own btCollisionDispatcher to manually rule out any reaction between these objects.

Anyone who knows better, feel free to chime in :)

- Alex
Post Reply