Jump to content

BaseTexture prop uscale not valid


Nikos123
 Share

Recommended Posts

 

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

 

 

Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

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

Link to comment
Share on other sites

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 ;

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...