Locking Camera to a Unit

Status
Not open for further replies.
Level 3
Joined
Jul 13, 2005
Messages
33
So I managed to get mouse look to work. However, the camera isn't centered on anything. I've tried a hell of a lot of different ways of getting the camera to center on a specific unit, but none seem to work.

Anyone else had any luck?

P.s. I'm talking about a rotating camera with mouse look, so please don't suggest a strict 3rd person camera that won't follow mouse look.
 
Level 8
Joined
Jun 28, 2008
Messages
356
Code:
camerainfo cam;

CameraInfoSetValue(cam, c_cameraValuePitch, ...);
CameraInfoSetValue(cam, c_cameraValueHeightOffset, 1.00);
CameraInfoSetValue(cam, c_cameraValueDistance, ...);
CameraInfoSetValue(cam, c_cameraValueYaw, ...);
[COLOR="Red"]CameraInfoSetTarget(cam, UnitGetPosition(...));[/COLOR]
CameraApplyInfo(1, cam, 0.00, 100, 0, true);

Execute it every 0.01 or so. The red line is the important one.
 
Level 3
Joined
Jul 13, 2005
Messages
33
Code:
camerainfo cam;

CameraInfoSetValue(cam, c_cameraValuePitch, ...);
CameraInfoSetValue(cam, c_cameraValueHeightOffset, 1.00);
CameraInfoSetValue(cam, c_cameraValueDistance, ...);
CameraInfoSetValue(cam, c_cameraValueYaw, ...);
[COLOR="Red"]CameraInfoSetTarget(cam, UnitGetPosition(...));[/COLOR]
CameraApplyInfo(1, cam, 0.00, 100, 0, true);

Execute it every 0.01 or so. The red line is the important one.

That's surely just going to cause a lot of un-needed lag.
 
Level 3
Joined
Apr 24, 2010
Messages
50
Why not just use the Action:

Camera - Make the camera look at and follow [Unit] for player 1


Or am I looking at this the wrong way?
 
Status
Not open for further replies.
Top