How to move objects?

  1. last year
    Edited last year by Sovereign174

    Edit: Figured it out. You still use addPhysicsChild, but also set Gravity on the Physics scene to be 0. That gives the desired effect, and applyImpulse and applyForce work.

    Just going off the 2D Basic Physics Example:

    for(int i=0; i < 200; i++) 
      shape = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 0.08,0.02);
      shape->setRoll(rand() % 360);
      shape->setPosition(-0.3 + (RANDOM_NUMBER*0.6), RANDOM_NUMBER);
      scene->addPhysicsChild(shape, PhysicsScene2DEntity::ENTITY_RECT, false);

    Since I don't want gravity, I changed addPhysicsChild to:

    scene->addCollisionChild(shape, PhysicsScene2DEntity::ENTITY_RECT);
    scene->applyForce(shape, 1, 1);

    Nothing moves no matter what numbers I've put in, and applyImpulse doesnt do it either. So how do i get them to move without them also seemingly attracted by a gravitational pull?

  2. I think you need to add physics in order to use the force. To add force to an object is physics related. Maybe you can try moving it by transform instead.

  3. [deleted]

    27 May 2016
    Deleted last year by fodinabor

or Sign Up to reply!