Hello,
I want to do as said in the title, I already have the two vector2s, and the distance working fine, I just need to know how I’d add the force to the object using the angle.
Here is an image of what I mean.
Cheers in advance.
Hello,
I want to do as said in the title, I already have the two vector2s, and the distance working fine, I just need to know how I’d add the force to the object using the angle.
Here is an image of what I mean.
Cheers in advance.
Don’t use an angle.
Use vectors.
A vector in the direction from a to b would be (b - a).
Rigidbody obj = this.rigidbody; //the rigidbody to effect
float amountOfForce = 10f; //amount of force to apply
var dir = b - a;
dir.Normalize(); //make it length one so you can multiply a force onto it using multiplicative identity
obj.AddForce(dir * amountOfForce);
Yeah, I figured it out last night, cheers for the help!