You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 23, 2024. It is now read-only.
With the newer Aframe versions above>1.0.4 it has an error THREE.Geometry is not a constructor for certain functions such as spring.
I'm not sure is the solution, I didn't test properly. But i have replaced: THREE.Geometry() with THREE.BufferGeometry() and tmp.fromBufferGeometry(meshes[0].geometry) with tmp = meshes[0].geometry.clone()
It seems to work.
function getGeometry (object) {
var matrix, mesh,
meshes = getMeshes(object),
tmp = new THREE.BufferGeometry(), // new THREE.Geometry(),
combined = new THREE.BufferGeometry(); // new THREE.Geometry(),
if (meshes.length === 0) return null;
// Apply scale – it can't easily be applied to a CANNON.Shape later.
if (meshes.length === 1) {
var position = new THREE.Vector3(),
quaternion = new THREE.Quaternion(),
scale = new THREE.Vector3();
if (meshes[0].geometry.isBufferGeometry) {
if (meshes[0].geometry.attributes.position
&& meshes[0].geometry.attributes.position.itemSize > 2) {
// tmp.fromBufferGeometry(meshes[0].geometry); tmp = meshes[0].geometry.clone();
}
} else {
tmp = meshes[0].geometry.clone();
}
tmp.metadata = meshes[0].geometry.metadata;
meshes[0].updateMatrixWorld();
meshes[0].matrixWorld.decompose(position, quaternion, scale);
return tmp.scale(scale.x, scale.y, scale.z);
}
// Recursively merge geometry, preserving local transforms.
while ((mesh = meshes.pop())) {
mesh.updateMatrixWorld();
if (mesh.geometry.isBufferGeometry) {
if (mesh.geometry.attributes.position
&& mesh.geometry.attributes.position.itemSize > 2) {
var tmpGeom = new THREE.Geometry();
// tmpGeom.fromBufferGeometry(mesh.geometry); tmpGeom = meshes.geometry.clone();
combined.merge(tmpGeom, mesh.matrixWorld);
tmpGeom.dispose();
}
} else {
combined.merge(mesh.geometry, mesh.matrixWorld);
}
}
The text was updated successfully, but these errors were encountered:
With the newer Aframe versions above>1.0.4 it has an error THREE.Geometry is not a constructor for certain functions such as spring.
I'm not sure is the solution, I didn't test properly. But i have replaced: THREE.Geometry() with THREE.BufferGeometry() and tmp.fromBufferGeometry(meshes[0].geometry) with tmp = meshes[0].geometry.clone()
It seems to work.
function getGeometry (object) {
var matrix, mesh,
meshes = getMeshes(object),
tmp = new THREE.BufferGeometry(), // new THREE.Geometry(),
combined = new THREE.BufferGeometry(); // new THREE.Geometry(),
if (meshes.length === 0) return null;
// Apply scale – it can't easily be applied to a CANNON.Shape later.
if (meshes.length === 1) {
var position = new THREE.Vector3(),
quaternion = new THREE.Quaternion(),
scale = new THREE.Vector3();
if (meshes[0].geometry.isBufferGeometry) {
if (meshes[0].geometry.attributes.position
&& meshes[0].geometry.attributes.position.itemSize > 2) {
// tmp.fromBufferGeometry(meshes[0].geometry);
tmp = meshes[0].geometry.clone();
}
} else {
tmp = meshes[0].geometry.clone();
}
tmp.metadata = meshes[0].geometry.metadata;
meshes[0].updateMatrixWorld();
meshes[0].matrixWorld.decompose(position, quaternion, scale);
return tmp.scale(scale.x, scale.y, scale.z);
}
// Recursively merge geometry, preserving local transforms.
while ((mesh = meshes.pop())) {
mesh.updateMatrixWorld();
if (mesh.geometry.isBufferGeometry) {
if (mesh.geometry.attributes.position
&& mesh.geometry.attributes.position.itemSize > 2) {
var tmpGeom = new THREE.Geometry();
// tmpGeom.fromBufferGeometry(mesh.geometry);
tmpGeom = meshes.geometry.clone();
combined.merge(tmpGeom, mesh.matrixWorld);
tmpGeom.dispose();
}
} else {
combined.merge(mesh.geometry, mesh.matrixWorld);
}
}
The text was updated successfully, but these errors were encountered: