CodingTrain / CodingTrain/Suggestion-Box

[Question][Help] Problem in Placing Stuff in Box2D

未关闭
#552 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
没有语言数据
星标
570
派生
85
PR 合并指标
30 天内没有已合并 PR

描述

Hello people,
Just to introduce the situation, I am a physics teacher and educator and I am also an aspiring artist, so you can imagine the power I felt in my hands when I first discovered Processing from Shiffman's YT channel and then I the videos on Box2D.

So in my skecth I have a gas container with a piston (to show the kinetic theory of gases) and this container position is determined by the Vec2 pos_pote. The problem is that when I try to place it elsewhere from the middle of the scene (width/2, height/2), the rectangles are draw properly but the fixtures of Box2D become a little bit shifted. The farther from the center of the screen pos_pote is, the more shifted the box2D fixtures become. I've been trying to debugg this for over three days, and I still don't know what is going on. Well, see for yourself:

[kinetic_gas.zip](https://github.com/CodingTrain/Rainbow-Topics/files/999492/kinetic_gas.zip)
_[click on the screen to place particles and notice the collision hitboxes are all shifted to the right from the containers perspective, in this case, pos_pote = (width/2+100, height/2), so things are misplaced only on the x axis.]_

I did not found anyone on the web with the same problem, so I'm desperate. If anyone could help me it would be totally awesome. Thanks very much,
Daniel.

贡献指南

这个仓库没有索引到贡献指南

调研方向

先打开 kinetic_gas.zip,检查 pos_pote 是如何用于绘制容器和创建 Box2D fixtures 的。在将容器移离屏幕中心的过程中,对比渲染出的矩形与 fixture 的位置;当碰撞 hitbox 始终与容器对齐时即表示完成。

由索引模型根据 Issue 内容生成。

评估

领域
game-dev
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。