jnsmalm / pixi3d

The 3D renderer for PixiJS. Seamless integration with 2D applications.
https://pixi3d.org
MIT License
759 stars 44 forks source link

Can 2D sprite node auto transform to Sprite3D? #66

Closed felemon closed 2 years ago

felemon commented 2 years ago

Hi, I Have an existing 2D pixi.js project.

There are many 2D Sprites in the project using spine animation.

Can 2D sprite node auto transform to Sprite3D?

How to combine pixi3d with pixi-spine node ?

eg in this demo https://codesandbox.io/s/github/jnsmalm/pixi3d-sandbox/tree/master/sprites-3d

Can I add a 2d sprite(pixi-spine sprite) to a bunny with right position and view?

jnsmalm commented 2 years ago

Hi!

See my answer here: https://github.com/jnsmalm/pixi3d/issues/64

In short: A 2D object won't inherit 3D transforms, use Camera.worldToScreen to place a 2D object at a 3D position.

felemon commented 2 years ago

Thanks for answering。

After Camera.worldToScreen placing a 2D object,How to implement 2D object move when camera change?

jnsmalm commented 2 years ago

You need to call Camera.worldToScreen every time the object changes position or the camera changes position (or any other property).