Rigidbody and addforce to center of object? JS

Hi guys!

Currently I have an object that jumps up using the rigidbody.addforce function but now I realize I need the force to go to the center of the object or a pivot point (it is linked with a fixed joint to another object) and not just up. Currently it looks like this : ` if (Input.GetKeyDown (KeyCode.Space)){

 GetComponent.<Rigidbody>().AddForce(new Vector3(0, 10, 0),ForceMode.Impulse);`

but I don’t know how to change the new Vector3 to the center/pivot of the object. Help would be greatly appreciated.

This should work

GetComponent.<Rigidbody>().AddForceAtPosition(new Vector3(0, 10, 0), transform.position, ForceMode.Impulse);

Also, for optimization’s sake, you should have a variable Rigidbody rigidbody, and on Start set it to GetComponent.<Rigidbody>() instead of getting it each time.

Thanks I got it!