akkel
Member
|
Set camera angle
Hi,how i can set camera angles?
|
|
11-08-2013 05:50 PM |
|
Ezequel
Member
|
RE: Set camera angle
Hi, if you search for "camera" in the tutorials project, there are some examples.
Maybe the info you need?
|
|
11-08-2013 06:38 PM |
|
akkel
Member
|
RE: Set camera angle
yeah,i'm trying to create fps controller, and i need to set angles, i looked tutorials and
i found function Cam.setAngle()
but i dont understand how to use it
|
|
11-08-2013 07:13 PM |
|
Esenthel
Administrator
|
RE: Set camera angle
There's a tutorial called camera modes, that shows 3 camera usages, like FPP TPP isometric.
|
|
11-08-2013 10:26 PM |
|
akkel
Member
|
RE: Set camera angle
In tutorial camera is attached to the head bone of character.
But i want to know how to manualy set angle of camera?
|
|
11-08-2013 11:05 PM |
|
Tottel
Member
|
RE: Set camera angle
Cam.setPosDir(..);
|
|
11-08-2013 11:09 PM |
|
Esenthel
Administrator
|
RE: Set camera angle
Hi, please look into the camera modes tutorial, in the place where the camera is being set based on the current head bone position, possibly using setPosDir, comment that out, and replace it with setAngle function.
Hope this helps
|
|
11-08-2013 11:23 PM |
|
akkel
Member
|
RE: Set camera angle
Thanks,its really helps,but i still have some problems:
-I created Player object with capsule collision, but collision not always working,i mean that character falling through terrain.
-for camera i used this function Cam.setAngle(Players[0].pos()+Vec(0, 2, 0),Players[0].angle.x,Players[0].angle.y, 0 ); but if i turn camera back game just stoping. Stoping game is mean error?
|
|
11-08-2013 11:50 PM |
|
akkel
Member
|
RE: Set camera angle
I fixed collision, my capsule collider was in wrong scale.
but i still cant fix game stoping.
|
|
11-09-2013 08:40 AM |
|
Rubeus
Member
|
RE: Set camera angle
What do you mean by 'turn the camera back' and 'the game stopping'?
|
|
11-09-2013 02:11 PM |
|
akkel
Member
|
RE: Set camera angle
i mean that if you are turning camera to ~340-360 degrees game just freezing, same if you trying look top.
|
|
11-09-2013 04:15 PM |
|
Tottel
Member
|
RE: Set camera angle
You'll have to show a bit more code.. I don't see anything that could crash on that line.
|
|
11-09-2013 04:18 PM |
|
akkel
Member
|
RE: Set camera angle
this is code for player:
bool update()
{
if(action)
{
if(Kb.b(KB_W) || Kb.b(KB_S) || Kb.b(KB_A) || Kb.b(KB_D) || Kb.b(KB_Q) || Kb.b(KB_E))actionBreak();
}
if(!action)
{
// turn & move
input.turn.x=Kb.b(KB_Q)-Kb.b(KB_E);
input.turn.y=Kb.b(KB_T)-Kb.b(KB_G);
input.move.x=Kb.b(KB_D)-Kb.b(KB_A);
input.move.z=Kb.b(KB_W)-Kb.b(KB_S);
input.move.y=Kb.b(KB_SPACE)-Kb.b(KB_LSHIFT);
// dodge, crouch, walk, jump
input.dodge = Kb.bd(KB_D)-Kb.bd(KB_A);
input.crouch= Kb.b (KB_LSHIFT);
input.walk = Kb.b (KB_LCTRL );
input.jump =(Kb.bp(KB_SPACE ) ? 3.5 : 0);
// mouse turn
Flt max=DegToRad(900)*Time.d();
angle.x-=Mid(Ms.d().x*1.7, -max, max);
angle.y+=Mid(Ms.d().y*1.7, -max, max);
}
//ScaleFactor(10);
Vec dir;
dir.x = angle.y;
dir.y = angle.x;
dir.normalize();
//Cam.setPosDir(pos(), dir);
Cam.setAngle(pos()+Vec(0, 2, 0), angle.x, angle.y);
return super.update();
}
|
|
11-09-2013 04:53 PM |
|