【发布时间】:2020-12-04 15:06:59
【问题描述】:
我想尝试使用amethyst_physics 库来制作游戏。 (呃)
我遵循了示例,但不知怎的我不工作:
use amethyst::GameDataBuilder;
use amethyst_physics::{PhysicsBundle};
use amethyst_nphysics::NPhysicsBackend;
fn main() -> amethyst::Result<()> {
amethyst::start_logger(Default::default());
let game_data = GameDataBuilder::default()
.with_bundle(
PhysicsBundle::<f32, NPhysicsBackend>::new()
)
;
Ok(())
}
错误:
the trait bound `amethyst_physics::PhysicsBundle<'_, '_, f32, amethyst_nphysics::NPhysicsBackend>: amethyst::amethyst_core::SystemBundle<'_, '_>` is not satisfied
the trait `amethyst::amethyst_core::SystemBundle<'_, '_>` is not implemented for `amethyst_physics::PhysicsBundle<'_, '_, f32, amethyst_nphysics::NPhysicsBackend>`
Here 就是一个例子。
我做错了什么?
【问题讨论】:
-
我尝试运行完全相同的代码,包括您提到的板条箱。有很多“使用未声明的板条箱或模块”。如果您添加一个可重复的示例以便读者可以尝试您所说的内容,那将是一个好主意。
-
@Mihir 我运行它没有问题,除了上面提到的预期错误。编辑:嗯,另外你必须将板条箱添加到你的 Cargo.toml
-
连编译都没有怎么运行?
-
我的意思是运行编译仅在预期错误时中断。我的错。
-
我让它在本地运行时出现同样的错误。 Cargo.toml
amethyst = { version = "0.15.3", features = ["empty"] } amethyst_nphysics = "0.2.0" amethyst_physics = "0.2.0"