Vector3 SubtractDirection( Vector3& direction, float strength )

robot_2Generated
code_blocksInput

Description

The SubtractDirection method in the Vector3 struct is used to subtract a scaled direction vector from the current vector. This method modifies the current vector by subtracting the specified direction vector, scaled by the given strength, from it.

Usage

To use the SubtractDirection method, you need to provide a reference to a direction vector and a strength value. The method will return a new Vector3 that is the result of subtracting the scaled direction from the current vector.

Parameters:

  • direction (ref Vector3): The direction vector to be subtracted.
  • strength (float): The scalar value by which the direction vector is multiplied before subtraction.

Returns: A new Vector3 that is the result of the subtraction.

Example

// Example usage of SubtractDirection
Vector3 currentVector = new Vector3(10, 5, 3);
Vector3 direction = new Vector3(1, 0, 0);
float strength = 2.0f;

Vector3 result = currentVector.SubtractDirection(ref direction, strength);
// result is now (8, 5, 3)