Add force only on local space

Hello, people!

I really don’t understand!

void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis (“Horizontal”);
float moveVertical = Input.GetAxis (“Vertical”);
Vector3 movement = new Vector3 (moveHorizontal, 0f, moveVertical);
rb.AddForce (movement * speed);

	if (Input.GetButtonDown ("Jump")) 
	{
		rb.AddForce (transform.up * jump);
	}

}  

This code attached to sphere. I want that ball can jump to the up, but addForce works in local space, I mean when I press down jump, force is pushing ball in axis Y but local not Global. When ball is rolling and his axis X in down direction ball doesn’t jump.

But in scripting said AddForce works in global space???

Can you explain me?

If the transform is rolling then its up, either in local or global space, will constantly be changing. If you want to apply an upwards force then just do so

if (Input.GetButtonDown ("Jump")) 
{
    rb.AddForce (Vector3.up * jump);
}

Thank you! Now is work like I wanted!