add a rotation to a direction Vector3

Hey,

i’ve got a simple question about vectors and rotations…

i have different points of a mesh and i want to place them on a new position. Everything works well if the object has no rotation on it. so i would to rotate a direction vector with a quaternion, but i have no idea how to do that…

here is my code:

var tempVertPoint: Vector3 = daVertices[counter];
tempVertPoint.Normalize();

var tempRay: Ray = Ray(transform.position, tempVertPoint);
var tempHit: RaycastHit;

var rayCastDistance: float = 100.0;		
var layerMask = 1 << 8;
layerMask = ~layerMask;
		
if (Physics.Raycast (tempRay, tempHit, rayCastDistance, layerMask)) {
	daVertices[counter] = tempDirection*tempHit.distance*2; //And why do i have to multiply with two to get the correct position of the hit point?
}

thanks for help!

You can multiply a vector by a quaternion to rotate the vector accordingly see here.

hey thanks, thats what i looked for

i tried with Vector3 * quaternion and that doesn’t work… :wink: