Open Utopiah opened 6 years ago
Simplified start using super-hands
https://glitch.com/edit/#!/scratch-blocks3d?path=super-hands.html with its Global Event Handler integration.
Consider also a snappable grid
// return the object closest to provided coordinates based on 1 provided class
// notes that the distance comparison is based on the center of the object
function getClosestObjectWithClass(coordinate, classFilter){
var result = null;
var smallestDistance = 999; // assuming 1km is a safe maximum distance
for (e of document.querySelectorAll("."+classFilter)) {
var testDistance = coordinate.distanceTo( e.object3D.getWorldPosition() );
if (testDistance < smallestDistance){
smallestDistance = testDistance;
result = e;
}
}
return result;
}
and invisible entities generated via https://github.com/ngokevin/kframe/tree/master/components/entity-generator/