AddForce relative to child position and rotation?

Again a question.

I was thinking…

Is it possible to make the AddForce relative to a child on the object?
Like position and rotation?

68574-test-222.png

I’ve got the GameObject (Going to name it Motor) with this script:

using UnityEngine;
using System.Collections;

public class Rotation : MonoBehaviour {
	public float Rotate = 10.0f;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if(Input.GetKey("b"))
			transform.Rotate (Vector3.back * Rotate * Time.deltaTime);
	
	}
}

And I want to apply its position and rotation to this AddForce :

GetComponent<ConstantForce>().GetComponent<Rigidbody>().AddForce (-transform.right * aPower * Time.deltaTime);

Is this even possible?
If yes, Please help me.

Thanks for reading!

You need to apply relative force to the ship’s rigidbody.

GameObject ship; //specify this
GameObject engine = ship.transform.GetChild(0); // assuming has only one rudder child
RigidBody shipRb  = ship.GetComponent<RigidBody>();

shipRb.AddForceAtPosition(-engine.forward, engine.transform.position); // assuming blue axis is the engine direction

Hope that helps.