How to position the bottom left back corner of a mesh to a particular point on a plane

I know of a simple way of positioning a box on a particular point on a place (see below)

    // Place any box over the plane and push it to the bottom left corner of the plane
    // Option A: 
    // 1. Get the coordinates of the bottom left corner of the wall C (Using getHierarchyBoundingVectors min & max)
    // 2. Find the distance between the bottom left corner and center of the box D (I have to have knowledge of the size of the box from creation time. I'm not sure how to derive it from a box mesh)
    // 3. box.position = Vector.add(C,D)
    // 4. box.rotation = plane.rotation 

However, this is quite verbose and requires writing math I’d like to skip. I’d ideally like to have a simple API for placing a certain corner of the object and snap to a certain corner/point on the plane

    // Option B: Grab the backleftcorner of the box and place it on bottom left corner of the plane (with rotation)
    // box.setPositionOfBackLeftCorner = plane.positionBackLeftCorner

Is there a Simple API that can be used to snap objects to a particular point on a plane such that a certain face/plane of an object aligns with the plane?

There are quite a few ways to do this.

2 Likes