- Home /
3rd person controller but want to use my mesh ?
Newbie to Unity....
So I have my space fighter showing in my game after I instantiate it (with lights, etc) and it looks good.
I now, of course want to move it around (and have the camera follow).
So I see the standard asset 3rd person controller script.
I am not able to make out how do I use this controllers with my space fighter.
I drop 3rd person controller in my scene and I can move the default construction guy around.
But how do I discard the construction guy and put my space fighter in instead??
Thanks for any help!
Answer by seyyid · Apr 08, 2011 at 04:44 AM
well you shouldnt drop 3rd person controller object into your scene
select your space fighter in hierarchy pane and add 3rd person controller and 3rd person camera script from component>scripts
those 2 scripts works for you
but make sure you remove 3rd person controller object from your scene or any other objects with 3rd person controller and 3rd person camera script
you may need to adjust controller collider to suit your player
peace
Hi, thanks but I must be doing something wrong.
$$anonymous$$y space fighter is a prefab and I instantiate it when the scene starts. So if I drop the 3rd person controller in my space fighter prefab it removes my space fighter entirely (mesh, materials) and I'm left with the construction guy.
If I drop my player ship prefab into the scene and then drop the 3rd person controller on it (in Hierarchy) then I get my mesh and the construction guy. I note that the camera target is blank in the inspector so I drop my space fighter game object into it. But running my game all I see is a blank screen.
i dont mean to add 3rd person controller in your space fighter prefab, you just need to add 3rd person controller SCRIPT and 3rd person camera SCRIPT, not the 3rd person construction worker itself, if you added these 2 scripts to your space ship fighter, and your space ship still cannot move or cannot be seen, make sure when u add 3rd person controller you set your controller collider well aligned to the ground(means collider must stay on the ground) there shouldnt be any other problem
Thanks for your patience! I am not out of the woods yet.
Okay so I added the scripts and when I run I get a null exception inside the thirdpersoncontroller on this line:
var cameraTransform = Camera.main.transform;
Any idea why?
Okay... I kept futzing around with it. did some stuff. deleted and recreated some of the objects and... all of sudden it is working!
Not sure what the earlier problem was.
Thank you!!
good to go then :) it works this way anyway, for your null exception error you must drag your main camera into Camera Transform of your 3rd person camera in your inspector pane :) good day !