Nikos123 Posted March 23, 2017 Share Posted March 23, 2017 Any idea whats changed in 2.3.0 ? matGround.diffuseTexture.uScale = common.MEDIUM_SIZE_MAP_SUBDIVISIONS; getting errors: ERROR in [at-loader] ./client/Ground.ts:18:30 TS2339: Property 'uScale' does not exist on type 'BaseTexture'. my source: https://github.com/QuantumInformation/Density-Wars/blob/master/client/Ground.ts#L18 Quote Link to comment Share on other sites More sharing options...
Nikos123 Posted March 23, 2017 Author Share Posted March 23, 2017 Figured it out, I need to cast the BaseTexture(ground. diffuseTexture ) as Texture GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
damian2taylor Posted May 17, 2017 Share Posted May 17, 2017 Hi @Nikos123, I just wanted to highlight the point you figured out. In a StandardMaterial, the textures are defined as BaseTexture objects (and not Texture objects, that extend BaseTexture): https://doc.babylonjs.com/classes/2.5/standardmaterial#diffusetexture-basetexture-classes-2-5-basetexture- Is that normal? Indeed, if I want to set properties such as uScale, vScale, uOffset or vOffset, I should cast my ambientTextures, diffuseTextures etc. as you did... but it could be risky, couldn't it? However, I am unable to do so: when I write: (BABYLON.BaseTexture(ground.diffuseTexture) as BABYLON.Texture) the BJS playground warns me: "Unexpected identifier". Thanks Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 29, 2017 Share Posted May 29, 2017 You cast like this in TS: (<BABYLON.Texture>ground.diffuseTexture) AlexB 1 Quote Link to comment Share on other sites More sharing options...
DylanD Posted June 12, 2018 Share Posted June 12, 2018 will this work if I use standard material instead of a texture? I can't seem to get it working. So lets say I have something like: var material = new BABYLON.StandardMaterial("texture",scene); material.diffuseTexture = new BABYLON.Texture("textures/background.png",scene); material.diffuseTexture.uScale = 2.0; Any ideas what I should do to get them to have the qualities uScale, vScale, and uOffset etc? I had this working in javascript but when I switched over to typescript it kept giving me this error: "Property 'uScale' does not exist on type 'BaseTexture'. Did you mean 'scale'?" I did not mean scale. Goal: Use .uScale on the StandardMaterial Problem: VScode/typescript says uScale does not exist on BaseTexture @Deltakosh ping Quote Link to comment Share on other sites More sharing options...
Guest Posted June 12, 2018 Share Posted June 12, 2018 write it like that: var material = new BABYLON.StandardMaterial("texture",scene); var texture = new BABYLON.Texture("textures/background.png",scene); texture.uScale = 2.0; material.diffuseTexture = texture ; DylanD 1 Quote Link to comment Share on other sites More sharing options...
DylanD Posted June 12, 2018 Share Posted June 12, 2018 1 hour ago, Deltakosh said: write it like that: var material = new BABYLON.StandardMaterial("texture",scene); var texture = new BABYLON.Texture("textures/background.png",scene); texture.uScale = 2.0; material.diffuseTexture = texture ; This worked great, thanks! GameMonetize 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.