I have an error when I try to define this const
in a character.rs
file:
当我尝试在character.ars文件中定义此常量时,出现错误:
const COLLISION_GROUPS_DEFAULT: CollisionGroups = CollisionGroups::new(
Group::GROUP_2,
Group::ALL - Group::GROUP_3
);
The error is:
错误是:
error[E0277]: cannot subtract `bevy_rapier2d::geometry::Group` from `bevy_rapier2d::geometry::Group` in const contexts
更多回答
优秀答案推荐
Instead of the -
operator, you can use difference
, which is const
:
您可以使用Difference代替-运算符,Difference为const:
const COLLISION_GROUPS_DEFAULT: CollisionGroups = CollisionGroups::new(
Group::GROUP_2,
Group::ALL.difference(Group::GROUP_3),
);
更多回答
我是一名优秀的程序员,十分优秀!