Skip to content

Commit

Permalink
defer to existing meshes
Browse files Browse the repository at this point in the history
  • Loading branch information
i-make-robots committed May 22, 2024
1 parent 04520d9 commit fc4bb2d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ private void updateSize() {

var meshInstance = findFirstChild(MeshInstance.class);
if(meshInstance!=null) {
meshInstance.setMesh(new Box(size.x,size.y,size.z));
var mesh = meshInstance.getMesh();
if(mesh==null || mesh instanceof Box) {
meshInstance.setMesh(new Box(size.x, size.y, size.z));
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ private void updateSize() {

MeshInstance meshInstance = findFirstChild(MeshInstance.class);
if(null != meshInstance) {
meshInstance.setMesh(new Capsule(length, radius));
var mesh = meshInstance.getMesh();
if(mesh==null || mesh instanceof Capsule) {
meshInstance.setMesh(new Capsule(length, radius));
}
}

MeshInstance b1 = findNodeByPath("Ball1/MeshInstance",MeshInstance.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ private void updateSize() {
body.setMass(mass);

MeshInstance meshInstance = findFirstChild(MeshInstance.class);
if(meshInstance!=null) {
meshInstance.setMesh(new Cylinder(length, radius, radius));
if(null != meshInstance) {
var mesh = meshInstance.getMesh();
if(mesh==null || mesh instanceof Cylinder) {
meshInstance.setMesh(new Cylinder(length, radius, radius));
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ private void updateSize() {

var meshInstance = findFirstChild(MeshInstance.class);
if(meshInstance!=null) {
meshInstance.setMesh(new Sphere((float) radius));
var mesh = meshInstance.getMesh();
if(mesh==null || mesh instanceof Sphere) {
meshInstance.setMesh(new Sphere((float) radius));
}
}
}

Expand Down

0 comments on commit fc4bb2d

Please sign in to comment.