I am trying to make a script for a rocket launcher with rockets that look towards where you point the mouse, so that if you hold the mouse over the target the rocket will aim towards it. I am using this code on the launcher:
var hit: RaycastHit;
if (Physics.Raycast(BarrelEnd.position, BarrelEnd.forward, hit)){
rocketClone.SendMessage("track",hit);
which works fine
and this code on the rocket
function track(tracker : RaycastHit){
Transform.LookAt(tracker);
}
which doesn’t work. I am a noob to unity and can’t find a way to fix this, so please could someone help.