InterpolateCamera help
#1

Hi, I'm interested in how to do next.

To get current player camera look and set at first x, y ,z for InterpolateCamera. And how to get body part x,y,z, to look at player's back, like this:



A camera with a current view just to approach to the player.
Reply
#2

I didn't test it but your code should look like this. You might have to change a thing or two.

PHP код:
new Float:PlayerX;
new 
Float:PlayerY;
new 
Float:PlayerZ;
new const 
Float:DISTANCE 2.0;
new 
Float:angle;
GetPlayerPos(playeridPlayerXPlayerYPlayerZ);
GetPlayerFacingAngle(playeridAngle);
SetCameraBehindPlayer(playerid);
angle angle+180.0;
new 
Float:F_FLOATSIN floatsin(-angledegrees);
new 
Float:F_FLOATCOS floatcos(-angledegrees);
TogglePlayerSpectating(playerid1);
InterpolateCameraPos(playeridPlayerXPlayerYPlayerZF_FLOATSINF_FLOATCOSPlayerZ2000CAMERA_MOVE); 
Reply
#3

Not working, I tried to change some things, but not with success..
Camera going to this coordinates:

Reply
#4

Actually, I'm not sure if you can take control of the player's camera without him being on Spectate mode or frozen.
You can remove "TogglePlayerSpectating" and replace it with "TogglePlayerControllable(playerid, 0); And use "SetPlayerCameraPos" instead of "InterpolateCameraPos" but it won't be smooth like the interpolate one.
Reply
#5

You don't understand me.

I want this.. let's me explain..



Start of interpolate camera must be on current camera look, to like from camera direct interpolate to front of player.
Reply
#6

You want it like to make it a class selection? If you want that, Set the player spectate mode on, player controllable off, set the camera pos, Set the Camera look at that's all.
Reply
#7

I want to get coordinates from front of player face, and modify camera to look like this:

Reply
#8

First use TogglePlayerControllable to freeze the player.

Then get the coords and the angle:

Код:
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
Then calculate the position in front of him (replace distance with the distance obviously):

Код:
new Float:camx = distance * floatsin(-a, degrees), Float:camy = distance * floatcos(-a, degrees);
After that set the camera pos to the camx, camy (and z from player position) values and the camera to look at the original Player Position.

Spectate Mode is unneccessary plus it will make it impossible to see your own character.


If you want the character to be a bit more on the right or left of the screen, you can calculate a small offset for the x/y Player Position (similar to how the cam x/y was calculated) to make the camera look at the side of the character.

If you want the cam to be smoothly positioning itself just use CAMERA_MOVE in SetPlayerCameraLookAt.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)