|
1 registered members (AndrewAMD),
1,065
guests, and 8
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: camera.x == player.x
[Re: Superku]
#327702
06/07/10 23:43
06/07/10 23:43
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
...
var lerped_z = (1-LerpAmount)*player.z + LerpAmount*other_z;
vec_set(camera.x, vector(player.x, player.y, lerped_z));
...
In Lerped_z formula, you many need to swap player.z and other.z around to get what you want... Or, another way is this
...
VECTOR tempV;
vec_lerp(tempV, player.x, vector(player.x, player.y, other_z), LerpAmount);
vec_set(camera.x, tempV);
...
NOTE, neither of these snippets have been tested...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: camera.x == player.x
[Re: EvilSOB]
#327706
06/08/10 00:03
06/08/10 00:03
|
Joined: May 2009
Posts: 5,366 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,366
Caucasus
|
I've tried to do like this:
vec_lerp(vector(camera.x,camera.y,0),vector(camera.x,camera.y,0),vector(player.x,player.y,0),0.2);
vec_lerp(vector(0,0,camera.z),vector(0,0,camera.z),vector(0,0,player.z),0.2);
But of course it fails  Superku, to make players camera to move smoother, I just made it to move smoother after the player, but that way, when you stand and look around you can notice that the camera center is not in the players center, will looks like you are turning around the player model, that why I want cameras X and Y to be always at the players center (X and Y), but Z must move smoother after the player. Play my beta project, you'll notice what I'm talking about.
|
|
|
Re: camera.x == player.x
[Re: 3run]
#327708
06/08/10 00:20
06/08/10 00:20
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
3run,
check the manual and you'll see that using the 'vector function' only creates a temporary vector. vec_lerp stores its result in the first parameter. So you are storing your results in a temporary vector, NOT in the actual camera properties. So your results with these commaands will be inconsistant.
What Beta project are you talking about? So I can see it in action... (just post a link to your project thread please)
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: camera.x == player.x
[Re: EvilSOB]
#327711
06/08/10 01:09
06/08/10 01:09
|
Joined: May 2009
Posts: 5,366 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,366
Caucasus
|
Here is my project: War Cloud Will it work, if I'll do the first line with vec_set and the second one with vec_lerp.
|
|
|
Re: camera.x == player.x
[Re: 3run]
#327718
06/08/10 04:13
06/08/10 04:13
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
OK, I think this is what you are after. I assume this code gets run once per frame. Ditch both old camera-control lines, and replace with this (untested) code.
...
VECTOR tempV; //note:: this line can be outside(before) the loop
...
vec_lerp(tempV, vec_diff(tempV, camera.x, player.x), 0.2);
vec_set(camera.x, vec_add(tempV, player.x));
...
PS :: You could also use three spare player.skill's instead of tempV if you want...
Last edited by EvilSOB; 06/08/10 04:17. Reason: PS added
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
|