Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lights don't work if added after app has started #5

Closed
vujadin opened this issue Oct 2, 2020 · 3 comments
Closed

Lights don't work if added after app has started #5

vujadin opened this issue Oct 2, 2020 · 3 comments

Comments

@vujadin
Copy link
Contributor

vujadin commented Oct 2, 2020

It looks like lights can't be added after app has started rendering loop.
This can be easily replicated in 'lighting' example if you delay creation of lights a bit:

let app = new PIXI.Application({
  backgroundColor: 0xdddddd, resizeTo: window, antialias: true
})
document.body.appendChild(app.view)

let mesh = app.stage.addChild(PIXI3D.Mesh3D.createCube())
mesh.rotationQuaternion.setEulerAngles(0, 30, 0)

setTimeout(function() {
	let pointLight = Object.assign(new PIXI3D.Light(), {
	  x: 1.1, y: 0.2, z: 2.0, color: [1, 0, 0], intensity: 10, type: PIXI3D.LightType.point,
	})
	PIXI3D.LightingEnvironment.main.lights.push(pointLight)
}, 10); 
@jnsmalm
Copy link
Owner

jnsmalm commented Oct 2, 2020

Thanks, I'll take a look at this.

@jnsmalm
Copy link
Owner

jnsmalm commented Oct 2, 2020

I think I have found fix for it. Please download/clone the develop branch and do "npm install" and then "npm run build" to create pixi3d.js inside the dist folder. Let me know if this version fixes the issue.

@vujadin
Copy link
Contributor Author

vujadin commented Oct 2, 2020

Yes, it works fine now. Thanks for the quick fix :)

@vujadin vujadin closed this as completed Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants