Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / rotate camera arounda point

Author
Message
ZbfZ
16
Years of Service
User Offline
Joined: 5th Mar 2008
Location:
Posted: 9th Mar 2008 22:50
what would the code be for rotating the camera around a certain point or, the center of an object?
kevinsbro
16
Years of Service
User Offline
Joined: 10th Feb 2008
Location:
Posted: 10th Mar 2008 01:52
axiagame
16
Years of Service
User Offline
Joined: 6th Dec 2007
Location: far far away...
Posted: 10th Mar 2008 02:05
do you mean rotate the camera around an object with the mouse, like an RTS game?
ZbfZ
16
Years of Service
User Offline
Joined: 5th Mar 2008
Location:
Posted: 10th Mar 2008 02:17
alright thanks for the code, but i mean like the camera auto moves it's self around a point or an object at a cetain speed
Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 10th Mar 2008 03:56
One simple way if you don't feel like doing the math is to create a function to:

Point camera at the object
Calculate distance to object
Move the camera forward by that amount
Rotate/turn the camera a few degrees
Move the camera the negative distance you calculated earlier


If you need help with this function let me know

Codger
p.s. just dont sync while this is happening

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
Kurt
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location:
Posted: 10th Mar 2008 09:25
Well hey, look in the samples project. Think it's called "camera" or something. There they create two cameras and one of them is rotating arround the player. Check out the code. You'll learn a lot more if you do it yourself by reading code
axiagame
16
Years of Service
User Offline
Joined: 6th Dec 2007
Location: far far away...
Posted: 10th Mar 2008 10:49
I don't think it is good idea looking at this code since it has no comments and variables names are like "a", "h" or "v"... It would be hard to understand also because it has got other functionalities...

ZbfZ, I give you some code how to rotate a camera around an object using the mouse... Just use it if you don't understand the sample project. Kurt is right, try to rewrite this code so you will understand how it works...

(this code is for a resolution of 640*480 , but you may change the resolution, if you make the necessary changes)
ZbfZ
16
Years of Service
User Offline
Joined: 5th Mar 2008
Location:
Posted: 11th Mar 2008 04:48
alright cool thanks, so for the resolution i would change

to this:

for a resolution of 1280 * 1024

alright, well thank you for the code, appreciate it guys
ZbfZ
16
Years of Service
User Offline
Joined: 5th Mar 2008
Location:
Posted: 11th Mar 2008 04:55
in that code though, where is it delcared which object the cam is following like the object "ID"
axiagame
16
Years of Service
User Offline
Joined: 6th Dec 2007
Location: far far away...
Posted: 11th Mar 2008 19:29
just create your object you want the camera to wollow and put your object number in the parenthesis of dbObjectPositionX(), Y and Z.

If your object moves, your camera will follow it if you put the objectX = dbObjectPositionX() (resp. Y & Z) in your loop.
Ghost in the shell
16
Years of Service
User Offline
Joined: 12th Mar 2008
Location:
Posted: 12th Mar 2008 15:05
hmmm... i try this code

its not work properly =((((
somebody any idia create camera from the third person with rotation???
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 14th Mar 2008 00:01
I personally think KURT has the SIMPLEST and CLEANEST CODE HERE that does exactly what was asked originally.

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 14th Mar 2008 00:01
Ghost in the shell
16
Years of Service
User Offline
Joined: 12th Mar 2008
Location:
Posted: 14th Mar 2008 09:30
Thank you, but i full integrate this code in my solution with litle correction =) I tell that technology is wrong. I and my frend create MMORPG and we create normal 3thd person camera view like in "WoW" or "Rune" game. look at attachment image =)

Attachments

Login to view attachments
Ghost in the shell
16
Years of Service
User Offline
Joined: 12th Mar 2008
Location:
Posted: 14th Mar 2008 13:29
For best 3thd person camera view look this link
http://forum.thegamecreators.com/?m=forum_view&t=123612&b=22
=)

Login to post a reply

Server time is: 2024-11-20 05:29:07
Your offset time is: 2024-11-20 05:29:07