Hi,
I want to create a rigid body that accelerates to the left when the left key is pressed. I created a ConstantAcceleration to the left and now I want to add it to the DefaultForceGeneratorSet force_generators. This is my code:
let mut left_acc = ConstantAcceleration::new(Vector2::new(-1.0, 0.0), 0.0); left_acc.add_body_part(BodyPartHandle(self.rigid_body_handle, 0)); force_generators.insert(Box::new(left_acc));
Rust gives me the following error on the last line:
error[E0277]: the trait bound nphysics2d::force_generator::constant_acceleration::ConstantAcceleration<{float}, std::option::Option<generational_arena::Index>>: nphysics2d::force_generator::force_generator::ForceGenerator<f32, generational_arena::Index> is not satisfied
Can someone explain how to solve this error?