How to apply force a object and detect collision

Post Reply
i7.strelok
Posts: 21
Joined: Fri Jan 20, 2017 10:44 pm

How to apply force a object and detect collision

Post by i7.strelok »

Hi, I'm student and I have two problems.
The first problem is:
I want apply force on a object in Y, but this object is not moving, only moving in X.
Here my code:
//FOR
MyObject *b = myVector.at(i);
b->getPhysicalRigidBody()->activate(true);

btVector3 froce(0.0, 2000.0, 0.0);
b->getPhysicalRigidBody()->applyCentralForce(froce);
The object is not moving with this code :cry: :cry: :cry:

My second problems is:

I want detect collision from 2 objects, if the objects collide then I need delete the objects, because I'm making game, its name is space invaders, so I need delete alien and bullet when they collide, so.. How to I detect collision ??
Post Reply