Hello, i have this code to position the heigh of the trees and rocks, with trees it works fine with rocks it doesn’t, the tree has a capsule collision, while the rock has a mesh collision.
Does anyone have some clue?
if (this.build[i].Trees===true) {
var tree=this.app.root.findByTag('tree');
for(var j=0;j<tree.length;j++) {
tree[j].enabled=true;
var ps=tree[j].getPosition();
this.vec1.set(ps.x, ps.y, ps.z);
var result, pos;
this.vec2.set(ps.x, 0, ps.z);
result = this.app.systems.rigidbody.raycastFirst(this.vec1, this.vec2);
if( result === null || result === undefined ){
pos = this.vec1;
pos.y = 0;
}else{
pos = result.point;
}
// position entity
tree[j].setPosition(pos);
}
}