Multiple scenes in 2D containers #32
Unanswered
DubMan1234
asked this question in
Q&A
Replies: 1 comment
-
You can have a different camera for each mesh if you want. let camera1 = new PIXI3D.Camera(app.renderer)
let camera2 = new PIXI3D.Camera(app.renderer)
// If you have a single mesh
mesh.material.camera = camera1
// If you have a model
model.meshes.forEach(mesh => {
mesh.material.camera = camera2
}) If you want to place an 3d object at the same screen position as a 2d object you can use Camera.screenToWorld https://api.pixi3d.org/classes/camera.html#screentoworld or (the opposite) Camera.worldToScreen https://api.pixi3d.org/classes/camera.html#worldtoscreen. For example: let screenX = 100
let screenY = 100
let distance = 1
topLeft.position = camera1.screenToWorld(screenX, screenY, distance)
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Can I have multiple 3D scenes in different 2D objects on the screen?
Added one object to a container in the top left and move it there.
Have a duplicate of that object in a different scene and move that for instance to the top right,
Having a different camera for each container.
Because of the nature of a 2D container, moving its x and y seems to have no effect on the positioning of the container either.
I know this is written in the notes. But is there a way to translate a 3D container to somewhere on the screen.
Adding a mesh to a container that has x and y co-ords makes no difference to the positioning of the final 3D object.
let topLeft = new PIXI3D.Container3D();
topLeft.x -= 100;
topLeft.y = 0;
root.addChild(topLeft);
Beta Was this translation helpful? Give feedback.
All reactions