transformDirection, help

Hello , I’m doing a tutorial that teaches me to apply force , I attached this script to camera

using UnityEngine ;
using System.Collections ;

public class Shooter : MonoBehaviour
{

public Rigidbody bullet ;
public float power = 1500F ;
public float moveSpeed ​​= 2f ;



/ / Update is called once per frame
void Update ()
{

float h = Input.GetAxis ( "Horizontal " ) * Time.deltaTime * moveSpeed ​​;
float v = Input.GetAxis ( "Vertical " ) * Time.deltaTime * moveSpeed ​​;
this.transform.Translate ( h , v, 0);

if ( Input.GetButtonUp ( " Fire1 "))
{

Rigidbody instance = Instantiate ( bullet , transform.position , transform.rotation ) as Rigidbody ;
Vector3 fwd = transform.TransformDirection ( Vector3.forward ) ;
instance.AddForce ( fwd * power ) ;
}

}
}

what is TransformDirection ? I read that transforms from a local variable in world variable but doing a debug.log the fwd.z remains 1. why? Thanks for answer!!!

It would be simpler to just use “transform.forward” instead of “transform.TransformDirection ( Vector3.forward )”. They both do the same thing, which is to return the forward direction of the transform in local space.

–Eric

thanks, in fact I couldn’t understand that line!!!