Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,791 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Simple camera movement #299597
11/25/09 12:34
11/25/09 12:34
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline OP
Serious User
Aku_Aku  Offline 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. blush
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
A
ApenasEu Offline
Newbie
ApenasEu  Offline
Newbie
A

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 Offline OP
Serious User
Aku_Aku  Offline 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.
Re: Simple camera movement [Re: Aku_Aku] #299602
11/25/09 12:57
11/25/09 12:57
Joined: Oct 2008
Posts: 23
A
ApenasEu Offline
Newbie
ApenasEu  Offline
Newbie
A

Joined: Oct 2008
Posts: 23
You mean independently of a given target or you want it to be focused on the other entity?

Re: Simple camera movement [Re: ApenasEu] #299603
11/25/09 13:07
11/25/09 13:07
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline OP
Serious User
Aku_Aku  Offline OP
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
Indepently, if it is possible.

Re: Simple camera movement [Re: Aku_Aku] #299604
11/25/09 13:11
11/25/09 13:11
Joined: Oct 2008
Posts: 23
A
ApenasEu Offline
Newbie
ApenasEu  Offline
Newbie
A

Joined: Oct 2008
Posts: 23
So you just want it to move around, if you programed a players movement that should be easy no?
Further more if you want the camera to hit hard surfaces instead of being like a god mode, you can create an entity, program its movement and attach the camera to that entity.

Re: Simple camera movement [Re: ApenasEu] #299605
11/25/09 13:17
11/25/09 13:17
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline OP
Serious User
Aku_Aku  Offline OP
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
So do you suggest have to use an entity?
Could you give a simple code, how to attach the camera to that, or a link to a simple example?

Re: Simple camera movement [Re: Aku_Aku] #299606
11/25/09 13:19
11/25/09 13:19
Joined: Oct 2008
Posts: 23
A
ApenasEu Offline
Newbie
ApenasEu  Offline
Newbie
A

Joined: Oct 2008
Posts: 23
Vec_set(camera.x, entity.x)

I also suggest you read the workshops, and explore the samples to try and grasp the basics.

Re: Simple camera movement [Re: ApenasEu] #299607
11/25/09 13:25
11/25/09 13:25
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline OP
Serious User
Aku_Aku  Offline OP
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
thanks


Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1