Пример #1
0
void BulletTestApp::mouseDrag( MouseEvent event )
{
	if ( mDragging ) {
		Vec2f pos	= Vec2f( event.getPos() ) / Vec2f( getWindowSize() );
		pos.y		= 1.0f - pos.y;
		Ray ray		= mCamera.generateRay( pos.x, pos.y, getWindowAspectRatio() );
		mDragConstraint.update( ray );
	}
}
Пример #2
0
void BulletTestApp::mouseDown( MouseEvent event )
{
	Vec2f pos	= Vec2f( event.getPos() ) / Vec2f( getWindowSize() );
	pos.y		= 1.0f - pos.y;
	Ray ray		= mCamera.generateRay( pos.x, pos.y, getWindowAspectRatio() );
	mDragging	= mWorld->intersects( ray, mCamera.getFarClip(), &mDragConstraint );
	if ( mDragging ) {
		mWorld->addConstraint( mDragConstraint, 0.0f, 0.01f );
	}
}