mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 06:01:14 +00:00
Removed type_mask and fixed some variable name
This commit is contained in:
parent
20b07a1fb5
commit
d6e413bb9c
17 changed files with 123 additions and 247 deletions
|
|
@ -153,23 +153,15 @@ float PhysicsShapeQueryParameters::get_margin() const {
|
|||
return margin;
|
||||
}
|
||||
|
||||
void PhysicsShapeQueryParameters::set_collision_layer(int p_collision_layer) {
|
||||
void PhysicsShapeQueryParameters::set_collision_mask(int p_collision_mask) {
|
||||
|
||||
collision_layer = p_collision_layer;
|
||||
collision_mask = p_collision_mask;
|
||||
}
|
||||
int PhysicsShapeQueryParameters::get_collision_layer() const {
|
||||
int PhysicsShapeQueryParameters::get_collision_mask() const {
|
||||
|
||||
return collision_layer;
|
||||
return collision_mask;
|
||||
}
|
||||
|
||||
void PhysicsShapeQueryParameters::set_object_type_mask(int p_object_type_mask) {
|
||||
|
||||
object_type_mask = p_object_type_mask;
|
||||
}
|
||||
int PhysicsShapeQueryParameters::get_object_type_mask() const {
|
||||
|
||||
return object_type_mask;
|
||||
}
|
||||
void PhysicsShapeQueryParameters::set_exclude(const Vector<RID> &p_exclude) {
|
||||
|
||||
exclude.clear();
|
||||
|
|
@ -200,11 +192,8 @@ void PhysicsShapeQueryParameters::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_margin", "margin"), &PhysicsShapeQueryParameters::set_margin);
|
||||
ClassDB::bind_method(D_METHOD("get_margin"), &PhysicsShapeQueryParameters::get_margin);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_collision_layer", "collision_layer"), &PhysicsShapeQueryParameters::set_collision_layer);
|
||||
ClassDB::bind_method(D_METHOD("get_collision_layer"), &PhysicsShapeQueryParameters::get_collision_layer);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_object_type_mask", "object_type_mask"), &PhysicsShapeQueryParameters::set_object_type_mask);
|
||||
ClassDB::bind_method(D_METHOD("get_object_type_mask"), &PhysicsShapeQueryParameters::get_object_type_mask);
|
||||
ClassDB::bind_method(D_METHOD("set_collision_mask", "collision_mask"), &PhysicsShapeQueryParameters::set_collision_mask);
|
||||
ClassDB::bind_method(D_METHOD("get_collision_mask"), &PhysicsShapeQueryParameters::get_collision_mask);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_exclude", "exclude"), &PhysicsShapeQueryParameters::set_exclude);
|
||||
ClassDB::bind_method(D_METHOD("get_exclude"), &PhysicsShapeQueryParameters::get_exclude);
|
||||
|
|
@ -213,8 +202,7 @@ void PhysicsShapeQueryParameters::_bind_methods() {
|
|||
PhysicsShapeQueryParameters::PhysicsShapeQueryParameters() {
|
||||
|
||||
margin = 0;
|
||||
collision_layer = 0x7FFFFFFF;
|
||||
object_type_mask = PhysicsDirectSpaceState::TYPE_MASK_COLLISION;
|
||||
collision_mask = 0x7FFFFFFF;
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
|
|
@ -249,14 +237,14 @@ Variant PhysicsDirectSpaceState::_intersect_shape(const RID& p_shape, const Tran
|
|||
}
|
||||
*/
|
||||
|
||||
Dictionary PhysicsDirectSpaceState::_intersect_ray(const Vector3 &p_from, const Vector3 &p_to, const Vector<RID> &p_exclude, uint32_t p_layers, uint32_t p_object_type_mask) {
|
||||
Dictionary PhysicsDirectSpaceState::_intersect_ray(const Vector3 &p_from, const Vector3 &p_to, const Vector<RID> &p_exclude, uint32_t p_collision_mask) {
|
||||
|
||||
RayResult inters;
|
||||
Set<RID> exclude;
|
||||
for (int i = 0; i < p_exclude.size(); i++)
|
||||
exclude.insert(p_exclude[i]);
|
||||
|
||||
bool res = intersect_ray(p_from, p_to, inters, exclude, p_layers, p_object_type_mask);
|
||||
bool res = intersect_ray(p_from, p_to, inters, exclude, p_collision_mask);
|
||||
|
||||
if (!res)
|
||||
return Dictionary();
|
||||
|
|
@ -276,7 +264,7 @@ Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParam
|
|||
|
||||
Vector<ShapeResult> sr;
|
||||
sr.resize(p_max_results);
|
||||
int rc = intersect_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, sr.ptr(), sr.size(), p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask);
|
||||
int rc = intersect_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, sr.ptr(), sr.size(), p_shape_query->exclude, p_shape_query->collision_mask);
|
||||
Array ret;
|
||||
ret.resize(rc);
|
||||
for (int i = 0; i < rc; i++) {
|
||||
|
|
@ -295,7 +283,7 @@ Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParam
|
|||
Array PhysicsDirectSpaceState::_cast_motion(const Ref<PhysicsShapeQueryParameters> &p_shape_query, const Vector3 &p_motion) {
|
||||
|
||||
float closest_safe, closest_unsafe;
|
||||
bool res = cast_motion(p_shape_query->shape, p_shape_query->transform, p_motion, p_shape_query->margin, closest_safe, closest_unsafe, p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask);
|
||||
bool res = cast_motion(p_shape_query->shape, p_shape_query->transform, p_motion, p_shape_query->margin, closest_safe, closest_unsafe, p_shape_query->exclude, p_shape_query->collision_mask);
|
||||
if (!res)
|
||||
return Array();
|
||||
Array ret;
|
||||
|
|
@ -309,7 +297,7 @@ Array PhysicsDirectSpaceState::_collide_shape(const Ref<PhysicsShapeQueryParamet
|
|||
Vector<Vector3> ret;
|
||||
ret.resize(p_max_results * 2);
|
||||
int rc = 0;
|
||||
bool res = collide_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, ret.ptr(), p_max_results, rc, p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask);
|
||||
bool res = collide_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, ret.ptr(), p_max_results, rc, p_shape_query->exclude, p_shape_query->collision_mask);
|
||||
if (!res)
|
||||
return Array();
|
||||
Array r;
|
||||
|
|
@ -322,7 +310,7 @@ Dictionary PhysicsDirectSpaceState::_get_rest_info(const Ref<PhysicsShapeQueryPa
|
|||
|
||||
ShapeRestInfo sri;
|
||||
|
||||
bool res = rest_info(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, &sri, p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask);
|
||||
bool res = rest_info(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, &sri, p_shape_query->exclude, p_shape_query->collision_mask);
|
||||
Dictionary r;
|
||||
if (!res)
|
||||
return r;
|
||||
|
|
@ -345,18 +333,11 @@ void PhysicsDirectSpaceState::_bind_methods() {
|
|||
//ClassDB::bind_method(D_METHOD("intersect_ray","from","to","exclude","umask"),&PhysicsDirectSpaceState::_intersect_ray,DEFVAL(Array()),DEFVAL(0));
|
||||
//ClassDB::bind_method(D_METHOD("intersect_shape","shape","xform","result_max","exclude","umask"),&PhysicsDirectSpaceState::_intersect_shape,DEFVAL(Array()),DEFVAL(0));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("intersect_ray", "from", "to", "exclude", "collision_layer", "type_mask"), &PhysicsDirectSpaceState::_intersect_ray, DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(TYPE_MASK_COLLISION));
|
||||
ClassDB::bind_method(D_METHOD("intersect_ray", "from", "to", "exclude", "collision_layer"), &PhysicsDirectSpaceState::_intersect_ray, DEFVAL(Array()), DEFVAL(0x7FFFFFFF));
|
||||
ClassDB::bind_method(D_METHOD("intersect_shape", "shape", "max_results"), &PhysicsDirectSpaceState::_intersect_shape, DEFVAL(32));
|
||||
ClassDB::bind_method(D_METHOD("cast_motion", "shape", "motion"), &PhysicsDirectSpaceState::_cast_motion);
|
||||
ClassDB::bind_method(D_METHOD("collide_shape", "shape", "max_results"), &PhysicsDirectSpaceState::_collide_shape, DEFVAL(32));
|
||||
ClassDB::bind_method(D_METHOD("get_rest_info", "shape"), &PhysicsDirectSpaceState::_get_rest_info);
|
||||
|
||||
BIND_ENUM_CONSTANT(TYPE_MASK_STATIC_BODY);
|
||||
BIND_ENUM_CONSTANT(TYPE_MASK_KINEMATIC_BODY);
|
||||
BIND_ENUM_CONSTANT(TYPE_MASK_RIGID_BODY);
|
||||
BIND_ENUM_CONSTANT(TYPE_MASK_CHARACTER_BODY);
|
||||
BIND_ENUM_CONSTANT(TYPE_MASK_COLLISION);
|
||||
BIND_ENUM_CONSTANT(TYPE_MASK_AREA);
|
||||
}
|
||||
|
||||
int PhysicsShapeQueryResult::get_result_count() const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue