pub fn terrain_to_heightfield(
        &mut self,
        terrain_handle: Handle<Node>,
        graph: &Graph,
    ) -> RigidBodyHandle {
        let terrain = graph[terrain_handle].as_terrain();
        let shape = Self::make_heightfield(terrain);
        let heightfield = ColliderBuilder::new(shape)
            .position_wrt_parent(Isometry3 {
                rotation: UnitQuaternion::default(),
                translation: Translation {
                    vector: Vector3::new(terrain.width() * 0.5, 0.0, terrain.length() * 0.5),
                },
            })
            .friction(0.0)
            .build();
        let (global_rotation, global_position) =
            graph.isometric_global_rotation_position(terrain_handle);
        let body = RigidBodyBuilder::new(BodyStatus::Static)
            .position(Isometry3 {
                rotation: global_rotation,
                translation: Translation {
                    vector: global_position,
                },
            })
            .build();
        let handle = self.add_body(body);
        self.add_collider(heightfield, &handle);
        handle
    }
/// Creates new heightfield rigid body from given terrain scene node.
Creates new heightfield rigid body from given terrain scene node.
Creates new heightfield rigid body from given terrain scene node .
pub fn terrain_to_heightfield(
        &mut self,
        terrain_handle: Handle<Node>,
        graph: &Graph,
    ) -> RigidBodyHandle {
        let terrain = graph[terrain_handle].as_terrain();
        let shape = Self::make_heightfield(terrain);
        let heightfield = ColliderBuilder::new(shape)
            .position_wrt_parent(Isometry3 {
                rotation: UnitQuaternion::default(),
                translation: Translation {
                    vector: Vector3::new(terrain.width() * 0.5, 0.0, terrain.length() * 0.5),
                },
            })
            .friction(0.0)
            .build();
        let (global_rotation, global_position) =
            graph.isometric_global_rotation_position(terrain_handle);
        let body = RigidBodyBuilder::new(BodyStatus::Static)
            .position(Isometry3 {
                rotation: global_rotation,
                translation: Translation {
                    vector: global_position,
                },
            })
            .build();
        let handle = self.add_body(body);
        self.add_collider(heightfield, &handle);
        handle
    }
pub fn terrain_to_heightfield ( & mut self , terrain_handle : Handle < Node > , graph : & Graph , ) -> RigidBodyHandle { let terrain = graph [ terrain_handle ] . as_terrain ( ) ; let shape = Self :: make_heightfield ( terrain ) ; let heightfield = ColliderBuilder :: new ( shape ) . position_wrt_parent ( Isometry3 { rotation : UnitQuaternion :: default ( ) , translation : Translation { vector : Vector3 :: new ( terrain . width ( ) * 0.5 , 0.0 , terrain . length ( ) * 0.5 ) , } , } ) . friction ( 0.0 ) . build ( ) ; let ( global_rotation , global_position ) = graph . isometric_global_rotation_position ( terrain_handle ) ; let body = RigidBodyBuilder :: new ( BodyStatus :: Static ) . position ( Isometry3 { rotation : global_rotation , translation : Translation { vector : global_position , } , } ) . build ( ) ; let handle = self . add_body ( body ) ; self . add_collider ( heightfield , & handle ) ; handle }
Creates new heightfield rigid body from given terrain scene node.
Creates new heightfield rigid body from given terrain scene node .
&mut self
terrain_handle
Handle<Node>
graph
&Graph