简体   繁体   English

Farseer-粒子只是穿过另一个身体

[英]Farseer - Particles just go thru another body

I am creating my maze like this: 我正在这样创建我的迷宫:

agentBody = BodyFactory.CreateBody(world, position);
_agentBody.BodyType = BodyType.Dynamic;
_agentBody.IgnoreGravity = true;
_agentBody.Restitution = 0.1f;
_agentBody.Friction = 1f;

_offset = ConvertUnits.ToDisplayUnits(1.5f);

FixtureFactory.AttachRectangle(3f, 0.1f, 1f, new Vector2(0, 1.55f), _agentBody);
FixtureFactory.AttachRectangle(3f, 0.1f, 1f, new Vector2(0f, -1.55f), _agentBody);
FixtureFactory.AttachRectangle(width, 3f, 1f, new Vector2(-1.55f, 0f), _agentBody);
FixtureFactory.AttachRectangle(width, 3f, 1f, new Vector2(1.55f, 0f), _agentBody);

and my sand particles like this: 和我的沙粒像这样:

for (int i = 0; i < 8; i++){
    _sands[i] = BodyFactory.CreateRectangle(_world, 0.05f, 0.05f, 1f);
    _sands[i].IsStatic = false;
    _sands[i].Restitution = 0.1f;
    _sands[i].Friction = 0.1f;
    _sands[i].Position = new Vector2(1.8f + i * 0.2f, 2.2f);
}

_sand = new Sprite(
    ScreenManager.Assets.TextureFromShape(
        _sands[0].FixtureList[0].Shape,
        MaterialType.Dots,
        Color.SandyBrown, 0.8f
    ));

I checked fixture in debug view and it looks fine. 我在调试视图中检查了灯具,看起来不错。 But it isn´t. 但它isn't。 When particles appear on the screen they fall down (because of gravity) and go through my maze borders without any problem and they stop at the bottom where there's a static body. 当粒子出现在屏幕上时,它们会由于重力而掉落并通过我的迷宫边界,没有任何问题,它们停在有静态物体的底部。 Why is that? 这是为什么? Why don't particles stop in my maze? 为什么颗粒不停在我的迷宫中?

For context, please see my previous question: 对于上下文,请参阅我之前的问题:
Farseer - Particles doesn´t move/bounce accord to borders Farseer-粒子不会根据边界移动/弹跳

I'm not very fluent with farseer, but what i can remember from a project a while back was that we used the 'CollidesWith' property of a fixture 我不太熟悉Farseer,但是从前一个项目中我能记得的是我们使用了灯具的'CollidesWith'属性

something like : 就像是 :

fixture.CollisionFilter.CollidesWith = CollisionCategories.All;

otherwise the discussion board of codeplex project can provide a lot of information. 否则,codeplex项目的讨论板可以提供很多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM