Camera apply to Player in MPgame

Hi Folks, i'm new to Unity3d (got my handy on last Frieday). today i started working on a small casual MPgame. At beginning the player has to host or connect(youtube tuts + with own expieriences) ... a Instance of the player is spawned, but the camera does not follow it, like it should... My TopCamera.js looks like this:

var cameraTarget : Transform;

var Dist_x = 22;
var Dist_y = 50;
var Dist_z = 0;
var Angle = 55;

function ApplyTarget(Target )
    cameraTarget = Target;
    //print("Versuch der Kamerazuweisung...");

function LateUpdate()
    transform.localEulerAngles.x = Angle;
    transform.position = Vector3(cameraTarget.position.x+Dist_x, cameraTarget.position.y+Dist_y, cameraTarget.position.z+Dist_z);

At Spawning the Player, it is apllied to cameraTarget in the spawn function like this:

public Transform kamera;
void SpawnPlayer()
    kamera.SendMessage ("ApplyTarget", "player");

Well, it Doesn't do it! if I apply it wehile running using the drop down in the Inspector, it works, but you couldn't do that in the Web or Standalone version, huh^^

So do anybody know how i best add my topdown camera to my spawned player? i know my networking code is written in c# and my camera in javascript, but this shouldn't be a problem ... should it?

Any Ideas how to fix this Prob?!?

By the Way, I'm an Proffessional Game Designer and 3D Artist, so no newcomer to games ... but i'm progging like one and are new to Unity and its Script-Languages^^

Thanks for any futur help, Mitsuomi

more ▼

asked Sep 13, 2010 at 10:26 PM

Mitsuomi gravatar image

1 3 2 4

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Sep 13, 2010 at 10:26 PM

Seen: 964 times

Last Updated: Sep 13, 2010 at 11:00 PM