Best way to orient a mesh

I have a vector and I want to create a mesh that will be oriented the same way. Sounds really basic but I can’t find a solution that works. Using that vector with a ray is almost what I’m looking for but I would like an actual mesh instead of the line I get from the RayHelper.
I tried rotation, rotationQuaternion, alignWithNormal, lookAt… I’m sure I’m missing something pretty obvious but can’t find it.

Hello and welcome! do you mind creating a playground of what you already have?

LookAt works but I don’t want to give it the target, because I want to add random variation to the vector. Also I’ll need to have the mesh not centered on the origin but starting from it (I’m able to do that, using the vector).

Ok I think look at is the right one
You can build the target by doing:

let target = mesh.position.add(direction)
1 Like

Ok so I just need to build a new target using the direction and use lookAt.
Same way, I create the position for the mesh so it originates from the origin.

This is 95% what I needed, just have to figure out the random angle.
Thanks for your help!

My pleasure!