However it is not working :
Ship Mamba :
class ShipMamba {
//....
setMesh(_mesh){
// console.log( "player MAMBA en set mesh" );
this.id_radar_screen = gb_radar_screen.register(this.alias);
this.total_boosters=2;
if( _mesh != null ){
this.mesh = _mesh.clone("player_raptor_mamba");
this.mesh_collider = scenes[this.parent_scene].getMeshByName("player_raptor_mamba.rx6_collider");
}
Bullet.setTypeBullet();
//escudo
this.shield = BABYLON.Mesh.CreateIcoSphere(this.name+"_shield_mesh", {radius:this.shield_data.radio, subdivisions: 8},scenes[SC_PLAYING]);
// this.shield = BABYLON.MeshBuilder.CreateSphere(this.name+"_shield_mesh", {diameter: 1, segments: SEGMENTS_SHIELD_ENEMIES}, scenes[SC_PLAYING]);
this.shield.material = blue_shield_material;
this.shield.isPickable = false;
this.shield.setEnabled(false);
// this.shield.position=this.mesh.position;
this.shield.parent = this.mesh;
this.pos_damage=new BABYLON.Vector3(0,0,0);
this.falling=false;
//proximity point
this.mesh_collider.rotationQuaternion = new BABYLON.Quaternion(0,0,0,1);
this.data_collider={actual:3,max:3};
this.shape = new BABYLON.PhysicsShapeMesh(this.mesh_collider,scenes[this.parent_scene]);
this.body = new BABYLON.PhysicsBody(this.mesh_collider, BABYLON.PhysicsMotionType.ANIMATED, false, scenes[this.parent_scene]);
this.body.shape = this.shape;
this.body.disablePreStep = false;
this.hit_mesh = BABYLON.MeshBuilder.CreateSphere(this.name+"_hit", {diameter: 0.15}, scenes[this.parent_scene]);
this.hit_mesh.parent = this.mesh_collider;
this.hit_mesh.material = test_mat_green.clone("hit_col_mamba");
this.cast_result = new BABYLON.ProximityCastResult();
}//end of set mesh
collision(){
// console.log( "en colision", this.name );
//colision CON big player ? ...
if( big_enemy != null ){
player.cast_result.reset();
big_enemy.cast_result.reset();
// Perform a shape proximity query with the first shape
havok.shapeProximity(
{
shape: player.shape,
position: player.mesh_collider.absolutePosition,
rotation: player.mesh_collider.absoluteRotationQuaternion,
maxDistance: 2
},
player.cast_result,
big_enemy.cast_result
);
console.log( this.cast_result.hasHit , big_enemy.cast_result.hasHit );
if (this.cast_result.hasHit && big_enemy.cast_result.hasHit) {
console.log( "hubo colis" );
const shapeLocalPos = this.cast_result.hitPoint;
const worldHitPos = big_enemy.cast_result.hitPoint;
// options.points[0] = shapeLocalPos.clone();
// options.points[1] = shapeLocalPos.clone().add(hitWorldResult.hitNormal);
// //options.points[1].normalize();
// options.instance = lines;
// lines = BABYLON.MeshBuilder.CreateLines("lines", options);
this.hit_mesh.position = shapeLocalPos;
big_enemy.hit_mesh.position = worldHitPos;
}
}//
}//fin de colision
}
Cruiser ::
class Cruiser {
//....
setMesh(){
//....
//proximity point
this.mesh_collider.rotationQuaternion = new BABYLON.Quaternion(0,0,0,1);
this.shape = new BABYLON.PhysicsShapeMesh(this.mesh_collider,scenes[this.parent_scene]);
this.body = new BABYLON.PhysicsBody(this.mesh_collider, BABYLON.PhysicsMotionType.STATIC, false, scenes[this.parent_scene]);
this.body.shape = this.shape;
this.body.disablePreStep = false;
this.hit_mesh = BABYLON.MeshBuilder.CreateSphere(this.name+"_hit", {diameter: 0.15}, scenes[this.parent_scene]);
this.cast_result = new BABYLON.ProximityCastResult();
this.id_radar_screen = gb_radar_screen.register(this.alias);
// console.log( this.name,", mi radar id es ",this.id_radar_screen );
gb_radar_screen.show(this.id_radar_screen);
}
}