freetoplay Posted October 25, 2018 Share Posted October 25, 2018 When I use BabylonJS with the TSLinter, I keep getting errors like: Property 'alpha' does not exist on type 'Camera'. How do I fix these linting errors? Quote Link to comment Share on other sites More sharing options...
ssaket Posted October 25, 2018 Share Posted October 25, 2018 We would need more info, could you paste your code here or create a playground ? Also, please check the api to see the public members (https://doc.babylonjs.com/api/classes/babylon.camera) Happy strict coding !! Quote Link to comment Share on other sites More sharing options...
freetoplay Posted October 25, 2018 Author Share Posted October 25, 2018 A basic code like this will throw an error in the linter: scene.activeCamera.alpha += Math.PI; My tsconfig file looks like this: { "compilerOptions": { "target": "es5", "module": "esnext", "moduleResolution": "node", "allowSyntheticDefaultImports": true, "sourceMap": true, "noImplicitAny": true, "removeComments": true, "preserveConstEnums": true, "baseUrl": ".", "lib": ["es2015", "dom"], "types": ["node", "jest", "babylonjs"], "paths": { "@/*": ["src/*"] } }, "include": ["src/**/*.ts", "src/**/*.vue", "tests/**/*.ts"], "exclude": ["node_modules"] } Quote Link to comment Share on other sites More sharing options...
ssaket Posted October 26, 2018 Share Posted October 26, 2018 It is because if you check the api link, again posting here (https://doc.babylonjs.com/api/classes/babylon.camera) there's no public member called as "alpha" and scene.activeCamera returns the base camera class as type. Assuming you are using ArcRotate or ArcFollow camera, refer to this PG -http://playground.babylonjs.com/ts.html#RNXXBZ you can change the active camera and see. Quote Link to comment Share on other sites More sharing options...
Guest Posted October 26, 2018 Share Posted October 26, 2018 Just cast: (<BABYLON.AcrcRotateCamera>)(scene.activeCamera)).alpha += Math.PI; ssaket 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.