Stopping bodies falling.

Stopping bodies falling.

edcampion的头像
CLOSED- Had damping at the bottom of the method. Sorry.

Hi, I want to fix bodies in mid air, but I do not want to them to be fixed in the x or z component. At the moment, I'm using an action, here is the applyAction

force.setMul4(-1,rb->getWorld()->getGravity() );

	force.setMul4(rb->getMass(),force);

	// Apply the gravity force.

	if(rb->getPosition()(1) < mOldPos(1))

	{

		rb->setLinearVelocity(hkVector4(rb->getLinearVelocity()(0),0,rb-     >getLinearVelocity()(2)) );

		rb->applyForce( stepInfo.m_deltaTime, hkVector4(0,force(1),0) ) ;

	}

This works, but I would prefer to just balance the forces, however if I do that the box rises.

1 条帖子 / 0 new
如需更全面地了解编译器优化,请参阅优化注意事项