[SOLVED] Raycast to position rocks

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++) {
                            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;
                                pos = result.point;
                            // position entity

Where is the pivot point of the rock as that’s what is used when you position the entity.

Good question,is a premade object i didn’t do it but i see what u mean, i will try to turn around the issue and let you know.

@yaustar i raycasted from y-1 and it worked, maybe the origin point is inside the object. Thanks a lot.