|
Simple camera movement
#299597
11/25/09 12:34
11/25/09 12:34
|
Joined: Sep 2009
Posts: 1,032 Budapest
Aku_Aku
OP
Serious User
|
OP
Serious User
Joined: Sep 2009
Posts: 1,032
Budapest
|
Help me, i am totally confused. I read so much the manual and tutorials, so i am lost.  I would create a little lite-C script that has one object and one camera. I want to move the object with w-a-s-d, and this is done. Now i want program the camera movement indepently from the object with up-down-left-right arrows. I am stucked here. Please give me a help.
|
|
|
Re: Simple camera movement
[Re: Aku_Aku]
#299599
11/25/09 12:46
11/25/09 12:46
|
Joined: Oct 2008
Posts: 23
ApenasEu
Newbie
|
Newbie
Joined: Oct 2008
Posts: 23
|
It would be helpfull i guess if you mentioned what you want to do with the camera?
Well i made my camera with the basics of cos and sin, i believe theres some other way but here it goes:
With a circle of radius 1 and origin 0,0, Cos(angle) and sin(angle) will give you the (x,y) coordinates to any point of the circunferance of that circle correspondingly (so cos for x and sin for y). So now for a moving origin and a radius that's not 1 you have, origin(x,y) - ( radius_of_the_circle * cos/sin(angle) ) You also have to add the angle difference to the pan of the camera to keep focus on the target if you want it to.
With that formula you can pan or tilt around the desired target, for zooming in and out you can make the radius a variable and adjust that correspondingly, i believe it is unnecessary to say that you need to do all that within a infinite loop.
Hope that helps and it's not too confusing, i'm not an expert at math by any means aswell but that worked pretty darn well for me, cheers.
|
|
|
Re: Simple camera movement
[Re: ApenasEu]
#299601
11/25/09 12:55
11/25/09 12:55
|
Joined: Sep 2009
Posts: 1,032 Budapest
Aku_Aku
OP
Serious User
|
OP
Serious User
Joined: Sep 2009
Posts: 1,032
Budapest
|
I would like simply to move the camera. When i press the up arrow then the camera moves forward, with down moves backward, with left moves left and with right arrow moves rigth.
Last edited by Aku_Aku; 11/25/09 12:55.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|