mirror of
https://github.com/Relintai/voxelman.git
synced 2024-11-22 10:57:30 +01:00
VoxelMesher's build_collider now returns an array, also it is now bound.
This commit is contained in:
parent
370e14f6c8
commit
e4b094a27c
@ -560,13 +560,11 @@ void VoxelMesher::_bake_liquid_colors(Node *p_chunk) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelMesher::build_collider(RID shape) const {
|
PoolVector<Vector3> VoxelMesher::build_collider() const {
|
||||||
ERR_FAIL_COND(shape == RID());
|
PoolVector<Vector3> face_points;
|
||||||
|
|
||||||
if (_vertices.size() == 0)
|
if (_vertices.size() == 0)
|
||||||
return;
|
return face_points;
|
||||||
|
|
||||||
PoolVector<Vector3> face_points;
|
|
||||||
|
|
||||||
if (_indices.size() == 0) {
|
if (_indices.size() == 0) {
|
||||||
|
|
||||||
@ -583,9 +581,7 @@ void VoxelMesher::build_collider(RID shape) const {
|
|||||||
face_points.push_back(_vertices.get((i * 4) + 2));
|
face_points.push_back(_vertices.get((i * 4) + 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysicsServer::get_singleton()->shape_set_data(shape, face_points);
|
return face_points;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
face_points.resize(_indices.size());
|
face_points.resize(_indices.size());
|
||||||
@ -593,7 +589,7 @@ void VoxelMesher::build_collider(RID shape) const {
|
|||||||
face_points.set(i, _vertices.get(_indices.get(i)));
|
face_points.set(i, _vertices.get(_indices.get(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysicsServer::get_singleton()->shape_set_data(shape, face_points);
|
return face_points;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelMesher::bake_lights(MeshInstance *node, Vector<Ref<VoxelLight> > &lights) {
|
void VoxelMesher::bake_lights(MeshInstance *node, Vector<Ref<VoxelLight> > &lights) {
|
||||||
@ -954,6 +950,7 @@ void VoxelMesher::_bind_methods() {
|
|||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("build_mesh"), &VoxelMesher::build_mesh);
|
ClassDB::bind_method(D_METHOD("build_mesh"), &VoxelMesher::build_mesh);
|
||||||
ClassDB::bind_method(D_METHOD("build_mesh_into", "mesh_rid"), &VoxelMesher::build_mesh_into);
|
ClassDB::bind_method(D_METHOD("build_mesh_into", "mesh_rid"), &VoxelMesher::build_mesh_into);
|
||||||
|
ClassDB::bind_method(D_METHOD("build_collider"), &VoxelMesher::build_collider);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("generate_normals", "flip"), &VoxelMesher::generate_normals, DEFVAL(false));
|
ClassDB::bind_method(D_METHOD("generate_normals", "flip"), &VoxelMesher::generate_normals, DEFVAL(false));
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ public:
|
|||||||
void bake_liquid_colors(VoxelChunk *chunk);
|
void bake_liquid_colors(VoxelChunk *chunk);
|
||||||
void _bake_liquid_colors(Node *p_chunk);
|
void _bake_liquid_colors(Node *p_chunk);
|
||||||
|
|
||||||
void build_collider(RID shape) const;
|
PoolVector<Vector3> build_collider() const;
|
||||||
|
|
||||||
void bake_lights(MeshInstance *node, Vector<Ref<VoxelLight> > &lights);
|
void bake_lights(MeshInstance *node, Vector<Ref<VoxelLight> > &lights);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user