English 中文(简体)
Farseer Physical (Box2D) - Fixtureheaded around point
原标题:Farseer physics (Box2D) - Fixture rotation around point

I m在Farseer物理学发动机(使用XNA)中,有点麻烦地轮流使用一种纤维。 基本,即有固定装置,即:

 private void setUpPhysics(World gWorld, Vector2 position)
    {
        body = new Body(gWorld);
        body.BodyType = BodyType.Dynamic;
        carFixture = FixtureFactory.AttachRectangle(ConvertUnits.ToSimUnits(21f), ConvertUnits.ToSimUnits(35f), 5f, ConvertUnits.ToSimUnits(position), body);
        carFixture.Restitution = 4f;
        carFixture.Friction = 5f;
        carFixture.Body.AngularDamping = 1f; 
        carFixture.Body.LinearDamping = 1f;
    }

Which i then rotate using the code

carFixture.Body.Rotation -= 0.01f;

Which works fine. The problem is, it always rotates around the top left corner of the rectangle, and i need it to rotate round the center. How would i go about rotating the fixture around it s center? (I apologize for my stupidity - i m new to Farseer / Box2D and i have no doubt it is the major cause of this problem, but i ve been searching the internet for a good few hours now and have found nothing.)

最佳回答

自行解决了这一问题,但尸体在中心周围轮换,但所附案文在左上轮轮换。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签