How to create a resistance to a force of an object??

spe02001

26-01-2010 06:04:37

How to create a resistance to a force of an object??

deshan

26-01-2010 07:54:14

Are you talking about a force like friction?
If yes
mScene->getMaterial(0)->setStaticFriction(0.5);
mScene->getMaterial(0)->setDynamicFriction(0.5);


else
Add a force to opposite direction
Main force
NxOgre::Vec3 direction;
int forcePower;
playerBody->addForce(direction*forcePower);


Resistance
NxOgre::Vec3 neg_direction = calculateNegativeDirection(direction);
int forcePower;
playerBody->addForce(neg_direction *forcePower);

LucaMoller

01-02-2010 20:56:47

Maybe you're talking about setting some damping on the body you want that "resistance". (try to be more specific about this resistance you want... :wink: ) To do this you can try to use the setLinearDamping() or setAngularDamping() methods.