About Store Forum Documentation Contact



Post Reply 
controll camera: view tpp
Author Message
Dante190884 Offline
Member

Post: #1
controll camera: view tpp
hello,
I have question: how to do to character don't move when we move camera?
for example: if we move camera up, the character moves with us to up in TPP View, look:

[Image: 54589409.jpg]

Code:
case VIEW_TPP:
         {
            Cam.dist=Max(1.8f,Cam.dist*ScaleFactor(Ms.wheel()*-0.1)); // update camera distance according to mouse wheel
            Cam.setSpherical(Players[0].ctrl_pos+Vec(0,0.5,0), Players[0].angle.x, Players[0].angle.y, 0, Cam.dist); // set spherical camera looking at player position with given player angles

         }
please help
(This post was last modified: 08-30-2010 10:28 PM by Dante190884.)
08-30-2010 10:19 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: controll camera: view tpp
put "if" before "angle.x+= angle.y+=
08-31-2010 12:19 PM
Find all posts by this user Quote this message in a reply
Dante190884 Offline
Member

Post: #3
RE: controll camera: view tpp
sorry, but don't understand. "angle.x, angle.y" influence only to camera.
I think, the "ctrl_pos" must be changed, but how?
(This post was last modified: 08-31-2010 02:14 PM by Dante190884.)
08-31-2010 02:10 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #4
RE: controll camera: view tpp
Well angle.x and angle.y is the character direction tho.

You need something like this to edit its direction on mouse change.
PHP Code:
Flt  max=DegToRad(900)*Time.d(),
dx =Ms.dir_ds.x*1.7,
dy =Ms.dir_ds.y*1.7*Ms.inv();
                
angle.x-=Mid(dx,-max,max);
angle.y+=Mid(dy,-max,max); 

And the camera moves on character angle.x and angle.y smile

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 08-31-2010 02:30 PM by Dynad.)
08-31-2010 02:29 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Dante190884 Offline
Member

Post: #5
RE: controll camera: view tpp
this code have tutorial "Camera modes". But the character look down, when camera look down. And i want to the character dont look down then.
08-31-2010 03:53 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #6
RE: controll camera: view tpp
So you want only look left and right but not up and down?

use this instead?:
PHP Code:
Flt  max=DegToRad(900)*Time.d(),
dx =Ms.dir_ds.x*1.7,
dy =Ms.dir_ds.y*1.7*Ms.inv();   

if(
Ms.b(1)) 
{     
angle.x-=Mid(dx,-max,max);
angle.y+=Mid(dy,-max,max);         
}else{
angle.x-=Mid(dx,-max,max);    


There is always evil somewhere, you just have to look for it properly.
08-31-2010 04:35 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Dante190884 Offline
Member

Post: #7
RE: controll camera: view tpp
no.
if camera look down, the "character" must be still look forward (not animated). In all game Tpp this works.
08-31-2010 05:07 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #8
RE: controll camera: view tpp
Ah ic if thats the case use the Cam functions.

e.g
Cam.setSpherical();
Cam.setPosDir(Cam.matrix.pos, Cam.matrix.z, Cam.matrix.y);
Cam.updateVelocities();
Cam.set();

There is always evil somewhere, you just have to look for it properly.
08-31-2010 05:14 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Dante190884 Offline
Member

Post: #9
RE: controll camera: view tpp
not in this the thing. Really, i don't know yet how works this trick. I think, the Vec ctrl_pos must be changed.
08-31-2010 05:33 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #10
RE: controll camera: view tpp
Well if the camera looks up or down whatever are you changing the pos of the character?? Thats kinda weird don't you think?

There is always evil somewhere, you just have to look for it properly.
08-31-2010 05:55 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Dante190884 Offline
Member

Post: #11
RE: controll camera: view tpp
@Dynad: read caution
08-31-2010 07:41 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #12
RE: controll camera: view tpp
Well i have read your post again and my conclusion is that i don't really understand what u want tho... for only camera movement just use the Cam functions what i said a few posts earlier.

There is always evil somewhere, you just have to look for it properly.
08-31-2010 07:58 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply