Vector3 SubtractDirection( Vector3& direction, float strength )

book_4_sparkGenerated
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 Vector3 direction and a float strength. The method will return a new Vector3 that is the result of subtracting the scaled direction from the current vector.

Example

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)