pub fn create_player<'a>(
    // Get the Builders of the entity:
    ent: &Read<'a, EntitiesRes>,
    lazy: &Read<'a, LazyUpdate>,

    // Insert to RigidBodyContainer and ColliderContainer
    pos: Vector<Real>,
    rigidbodies: &mut RigidBodyContainer,
    colliders: &mut ColliderContainer,

) {
    // Create the rigidbody and colliders.
    /* Create our rigid body */
    let rigidbody = RigidBodyBuilder::new_dynamic()
        .translation(pos)
        .additional_mass(120.0)
        .linear_damping(1.0)
        .angular_damping(0.2)
        .build();
    
    /* Create the colliders (1 for now) */
    let collider = ColliderBuilder::cuboid(4.0, 1.0, 2.0)
        .restitution(0.2)
        .build();
    
    // These are stored in the entity.
    let rigidbody_handle = rigidbodies.0.insert(rigidbody);
    // Remember to insert the collider with the parent.
    let collider_handle = colliders.0.insert_with_parent(collider, rigidbody_handle, &mut rigidbodies.0);

    // Create the specs entity.
    lazy.create_entity(&ent)
        .with(PlayerCar { touching_ground: false })
        .with(ModelName {
            name: ['c', 'a', 'r', '0', '0'],
        })
        .with(PhysicsObject {
            object_type: PhysicsType::Dynamic,
            rigidbody: rigidbody_handle,
            colliders: vec![collider_handle],
        })
        .build();
}
// Create entity from Read<Lazy> and Entities
Create entity from Read and Entities
Create entity from Read and Entities
pub fn create_player<'a>(
    // Get the Builders of the entity:
    ent: &Read<'a, EntitiesRes>,
    lazy: &Read<'a, LazyUpdate>,
    // Insert to RigidBodyContainer and ColliderContainer
    pos: Vector<Real>,
    rigidbodies: &mut RigidBodyContainer,
    colliders: &mut ColliderContainer,
) {
    // Create the rigidbody and colliders.
    /* Create our rigid body */
    let rigidbody = RigidBodyBuilder::new_dynamic()
        .translation(pos)
        .additional_mass(120.0)
        .linear_damping(1.0)
        .angular_damping(0.2)
        .build();
    /* Create the colliders (1 for now) */
    let collider = ColliderBuilder::cuboid(4.0, 1.0, 2.0)
        .restitution(0.2)
        .build();
    // These are stored in the entity.
    let rigidbody_handle = rigidbodies.0.insert(rigidbody);
    // Remember to insert the collider with the parent.
    let collider_handle = colliders.0.insert_with_parent(collider, rigidbody_handle, &mut rigidbodies.0);
    // Create the specs entity.
    lazy.create_entity(&ent)
        .with(PlayerCar { touching_ground: false })
        .with(ModelName {
            name: ['c', 'a', 'r', '0', '0'],
        })
        .with(PhysicsObject {
            object_type: PhysicsType::Dynamic,
            rigidbody: rigidbody_handle,
            colliders: vec![collider_handle],
        })
        .build();
}
pub fn create_player < ' a > ( // Get the Builders of the entity: ent : & Read < ' a , EntitiesRes > , lazy : & Read < ' a , LazyUpdate > , // Insert to RigidBodyContainer and ColliderContainer pos : Vector < Real > , rigidbodies : & mut RigidBodyContainer , colliders : & mut ColliderContainer , ) { // Create the rigidbody and colliders. /* Create our rigid body */ let rigidbody = RigidBodyBuilder :: new_dynamic ( ) . translation ( pos ) . additional_mass ( 120.0 ) . linear_damping ( 1.0 ) . angular_damping ( 0.2 ) . build ( ) ; /* Create the colliders (1 for now) */ let collider = ColliderBuilder :: cuboid ( 4.0 , 1.0 , 2.0 ) . restitution ( 0.2 ) . build ( ) ; // These are stored in the entity. let rigidbody_handle = rigidbodies . 0 . insert ( rigidbody ) ; // Remember to insert the collider with the parent. let collider_handle = colliders . 0 . insert_with_parent ( collider , rigidbody_handle , & mut rigidbodies . 0 ) ; // Create the specs entity. lazy . create_entity ( & ent ) . with ( PlayerCar { touching_ground : false } ) . with ( ModelName { name : [ 'c' , 'a' , 'r' , '0' , '0' ] , } ) . with ( PhysicsObject { object_type : PhysicsType :: Dynamic , rigidbody : rigidbody_handle , colliders : vec ! [ collider_handle ] , } ) . build ( ) ; }
Create entity from Read<Lazy> and Entities
Create entity from Read<Lazy > and Entities
ent
&Read<'a, EntitiesRes>
lazy
&Read<'a, LazyUpdate>
pos
Vector<Real>
rigidbodies
&mut RigidBodyContainer
colliders
&mut ColliderContainer
ent
&Read<'a, EntitiesRes>
lazy
&Read<'a, LazyUpdate>
pos
Vector<Real>
rigidbodies
&mut RigidBodyContainer
colliders
&mut ColliderContainer