Update: CC - Mouse Move - Moorcow (ud33b2z225.js) 1815 bytes modified
parent
1df2d4e112
commit
30390f146a
|
@ -32,86 +32,4 @@ this.thrower.instance.lookAt(
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* First we find our crosshair
|
||||
*/
|
||||
//var crosshair = GameLib.EntityManager.Instance.findComponentById('oxpg88pgzv');
|
||||
//var sphere = GameLib.EntityManager.Instance.findComponentById('ijir4gkqya');
|
||||
|
||||
/**
|
||||
* Target, is the x / y postion of the crosshair on the z=0 plane in the crosshair scene
|
||||
*/
|
||||
//var target = new THREE.Vector3(
|
||||
// (-1 * (window.innerWidth / 2 - data.event.x)) ,
|
||||
// (window.innerHeight / 2 - data.event.y) ,
|
||||
// 0
|
||||
//);
|
||||
/*
|
||||
sphere.instance.position.copy(target);//instance.applyMatrix4( mInverse );
|
||||
sphere.position.x = sphere.instance.position.x;
|
||||
sphere.position.y = sphere.instance.position.y;
|
||||
sphere.position.z = sphere.instance.position.z;
|
||||
*/
|
||||
/**
|
||||
* Now we get the position of the crosshair, in our world scene space
|
||||
*/
|
||||
/*
|
||||
target.unproject(camera.instance);
|
||||
*/
|
||||
/**
|
||||
* We want to shoot in the other direction
|
||||
*/
|
||||
/*
|
||||
target.normalize();
|
||||
|
||||
target.z *= -1;
|
||||
*/
|
||||
|
||||
//target.sub(thrower.position.instance).normalize();
|
||||
/*
|
||||
var raycaster = new THREE.Raycaster();
|
||||
|
||||
raycaster.ray = new THREE.Ray(
|
||||
cursor.position.instance,
|
||||
target.instance
|
||||
);
|
||||
|
||||
var intersects = raycaster.intersectObjects(
|
||||
GameLib.EntityManager.Instance.queryComponents(GameLib.D3.Mesh).map(
|
||||
function(mesh){
|
||||
|
||||
if (mesh.instance.material instanceof Array) {
|
||||
mesh.instance.material.map(
|
||||
function(material) {
|
||||
material.color.setHex(0xffffff);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
mesh.instance.material.color.setHex(0xffffff);
|
||||
}
|
||||
|
||||
return mesh.instance;
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
if (intersects.length > 0) {
|
||||
console.log('intersected');
|
||||
intersects.map(
|
||||
function(intersect){
|
||||
if (mesh.instance.material instanceof Array) {
|
||||
mesh.instance.material.map(
|
||||
function(material) {
|
||||
material.color.setHex(0xff0000);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
mesh.instance.material.color.setHex(0xff0000);
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//@ sourceURL=mouseMove.js
|
Loading…
Reference in New Issue