The easy solution would be to simply give the object a BoxCollider and a Rigidbody and let the Unity physics engine figure out how it lands. But let's assume you have a good reason why you want to use your own physics and thus want to calculate it yourself.
You will have to cheat here a bit, because in many situations there will be two correct solutions. ...
Spaces and Matrices
First of all, as you know, we use matrices to represent and to do coordinate transformations. They can be any of the affine transformations. That includes translation, scaling, rotation, shear, and reflection transformations.
We (traditionally) have three coordinate systems to work with:
Model space (Sometimes called "Object space"): ...
Let's attack this in parts: we'll find where to place the end of the first bone, then figure out where the other two go. Once we've arranged the first bone, what remains is a two-bone IK problem, which we already know how to solve analytically.
The trick is to understand the constraints on where the end of the first bone can end up. It can't be further away ...
Turns out the solution to the fundamental problem is to avoid the complicated math and just use an appropriately-configured HingeJoint. When a player grabs an object, set node A to a kinematic body child node of that controller, and set node B to the object being grabbed. Set both paths to empty strings when they let go.
The actual result is a little wonky, ...
I have found the answer here. Although it is not completely explained mathematically in my opinion, it works well.
The code I use is like this:
private void Start()
/// Source: https://forum.unity.com/threads/dynamic-loaded-object-fit-to-screen-size.349794/
"How to change the up vector of something in Unreal ?" The answer is simple - to change the upvector you simply need to change the object's rotation.
To make your upvector to point to something - you can use innate function of FMath
especially take a look at: MakeRotFromXZ family of functions.
Another user was struggling to implement this with the existing answer, so I thought I'd show a slightly deeper code example for folks in a similar situation.
I'll use Unity C# syntax since it's what I use most often, but the same steps can be applied to any language/framework.
CalculateVertexNormals(Vector3 vertexPositions, int triangleIndices, ...