Comments (2)
It lokks like the problem is centering the object.
In the last commit i removed the autocentering code and moved it to the .html file, to be more compliant with threejs loading procedure.
In attachment an example:
nxs centering example.zip
from nexus.
I'm so sorry that the problem is because I didn't include corto.js in my project so ......
about how to center the object I have another solution without scaling model
//my program is showing a single model
function onLoadNxObjOver()
{
var p = new THREE.Vector3();
g_NexusObj.geometry.boundingBox.getCenter(p);
//move objec to (0,0,0)
g_NexusObj.position.set(-p.x, -p.y, -p.z);
//not necessary but my special demands
g_Obj = new THREE.Object3D();
g_Obj.add(g_NexusObj);
g_scene.add(g_Obj);
fitCameraToObject( g_camera, g_NexusObj.geometry.boundingBox, 1 );
}
// my camera's init position is (0,0,z?)
function fitCameraToObject( camera, boundingBox, offset )
{
offset = offset || 1.25;
const size = new THREE.Vector3();
boundingBox.getSize(size);
const maxDim = Math.max( size.x, size.y, size.z );
const fov = camera.fov * ( Math.PI / 180 );
cameraZ = Math.abs( maxDim * 2 * Math.tan( fov * 2 ) );
cameraZ *= offset;
camera.position.z = cameraZ;
}
from nexus.
Related Issues (20)
- Select more appropriate exception classes
- Move code from main() functions into methods of application objects
- How to render the quadrilateral? HOT 10
- Installation of nxscompress failed HOT 2
- Source for Nexus3D package HOT 1
- Retrieving mesh structure and names HOT 4
- About QEM effect! HOT 2
- render the same nxz object in multiple canvas with multiples renderers HOT 1
- when you zoom out, Nexux will delete more vertexes and triangles? HOT 1
- multiple materials and texture errors HOT 7
- On the issue of model size changes after conversion HOT 3
- Segmentation fault with -O when using nxsbuild HOT 1
- Loss of texture quality after converting .ply + texture to .nxs on large mesh HOT 1
- Importing NexusObject from nexus3d in a js file
- Export to .STL? HOT 1
- Failed mapping texture data HOT 1
- Build using QMAKE broken HOT 3
- Raycaster often doesn't return nearest intersection point HOT 2
- texture of OBJ file not used in NXS file
- handle special characters in filenames HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nexus.