Finding a direction for AddForce - help please c#

Hey, I’m stuck with shooting this projectile in the direction of

origin = gameObject.transform.position
the vector3 I want to shoot at = LookDir

This wouldn’t be a problem but I cannot use transform.LookAt(LookDir) then transform.forward for direction …

So my question is how can I use LookDir to gain a direction to face from gameObject.transform.position ??

Really hope someone knows, example is below.

		                LookDir = Target.transform.position;
			
				GameObject Proj;
				Proj = Instantiate (ItemExampleProj, Player.transform.position, Player.transform.rotation) as GameObject;
				Proj.rigidbody.AddForce(????? * 5.0f, ForceMode.Impulse);  // What do I need to put here??

The look at direction is the same as the:

transform.forward

Then you can do the parent’s position + the object forward direction that you want to shoot. Unless you want the projectile forward? Then use this:

Proj.transform.forward

But normally you do not want the projectile’s forward. I would recommend:

Proj.rigidbody.AddForce((transform.position + transform.forward).normalized * 5.0f, ForceMode.Impulse);

Because you want to send the projectile from the position of the player to the direction that the player is facing. You can normalize it which will reduce the magnitude to 1. Which I believe can just be simplified to the transform.forward. But eh, I haven’t been working with rigidbodies for a while.

Thanks for the suggestion but its not really helped at all :frowning:

Basically what I’m trying to do now is use AddForce to move an object, however I can’t touch its rotation or what its looking at.

so I need to try and use a target as a Vector3 and the objects own location. So

its own location is the origin Vector3 I can use

a variable containing a Vector3 is the point I want to get to (target)

how can I use those two with AddForce to get the desired result.