Question by
AlexDetermination · Apr 22 at 08:13 AM ·
c#vector3
Applying a force which get's weaker as the object is closer to the source
The basic ideas is that when the player collects this powerup, the player will freeze, and suck all enemies towards them, by applying a force using the Vector3 tranform.position - nearbyObj.gameObject.transform.position
However, like the title stated, I would like so that if the enemy is closer to the player, the "pull" force will be weaker, and I already pulled up Desmos and devised the perfect equation, (1/x^2).
However, the operator / (divide) cannot be used to dividors of type Vector3. So is there another solution to this problem?
Comment