How do I scale the texture on a spatial?

Hi, I noticed meshes do have this method:

scaleTextureCoordinates(new Vector2f(1,1));

But sadly spatials dont.

How can I scale a texture to fit my spatial?

I’m making planets with textures and I need to repeat my textures multiple times for bigger planets…

So how do I do that?

(Also, nice work having the sphere unwrap so that it is seamless!)

Change spatial to Geometry then do geo.getMesh().scaleTextureCoordinates(new Vector2f(1,1));

Gots it :stuck_out_tongue:

1 Like

@Addez: not change… spaial is abstract and it can be Node or Geometry.

Geometry = Spatial

Node = Spatial

remember it :wink:

use this to scale all subGeometries:

[java]public void setTextureScale(Spatial spatial, Vector2f vector) {

if (spatial instanceof Node) {

Node findingnode = (Node) spatial;

for (int i = 0; i < findingnode.getQuantity(); i++) {

Spatial child = findingnode.getChild(i);

setTextureScale(child, vector);


} else if (spatial instanceof Geometry) {

((Geometry) spatial).getMesh().scaleTextureCoordinates(vector);



1 Like