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.

Newcomers DBPro Corner / right click, rotate camera?

Author
Message
ORLY
18
Years of Service
User Offline
Joined: 28th Aug 2006
Location:
Posted: 6th Sep 2008 16:56
Hi,

ok i want to make some kind of 3rd person game, i've got the 3rd person camera ready, but i want to know how to rotate the camera, when you hold right click you can move your mouse and the camera will rotate like in those MMORPG games these days.

how would i go about doing this?

thanks.
HWT
19
Years of Service
User Offline
Joined: 1st Apr 2005
Location: Earth
Posted: 7th Sep 2008 02:01
I'm not entirely certain if this is what you need and I'm assuming your not completely new to programming in DBP (if you are post back and I'll try to explain this better). Just copy and paste into the editor to see it work:



Hello world tommorrow
ORLY
18
Years of Service
User Offline
Joined: 28th Aug 2006
Location:
Posted: 7th Sep 2008 06:05
Hi,

i've added it to my code and it works, but when i rotate the camera it isn't smooth, is there any way to smooth it?

Thanks.
HWT
19
Years of Service
User Offline
Joined: 1st Apr 2005
Location: Earth
Posted: 7th Sep 2008 13:29
Yes - using the curvevalue command like so:



You only need to replace this last bit (updating camera position) in the main code I posted earlier.

Hello world tommorrow
ORLY
18
Years of Service
User Offline
Joined: 28th Aug 2006
Location:
Posted: 7th Sep 2008 14:22
Hi,

I've used:



This works but you can't rotate around the object, it will just go back and forth like a rocking chair.

and i've used:



This will make the camera very far from the object.

hmm..
HWT
19
Years of Service
User Offline
Joined: 1st Apr 2005
Location: Earth
Posted: 7th Sep 2008 15:29
Whoopsy! Change this:


to...


My mistake was I used Camera Position X instead of Z - sorry about that

Hello world tommorrow
ORLY
18
Years of Service
User Offline
Joined: 28th Aug 2006
Location:
Posted: 8th Sep 2008 07:21
Hi,

Thank you very much for your help HWT!
ORLY
18
Years of Service
User Offline
Joined: 28th Aug 2006
Location:
Posted: 8th Sep 2008 08:38
Hi HWT,

i've got one last question on this topic. how would i rotate the camera on the Y axis?

Thanks for your help.
HWT
19
Years of Service
User Offline
Joined: 1st Apr 2005
Location: Earth
Posted: 8th Sep 2008 14:06
I haven't tested this, but try something like:


Notice I've changed angle y to angle x and position x and z to position y

Hello world tommorrow
ORLY
18
Years of Service
User Offline
Joined: 28th Aug 2006
Location:
Posted: 8th Sep 2008 15:46
Hi,

Ok so i can't see my previous post and i'm not sure if i asked for rotating the camera on the X axis or Y axis.

Anyways, that code makes it rotate on the X axis, i'm trying to rotate on both X and Y axis.

i've tried:


this makes the camera "stuck" when you hold right click.
HWT
19
Years of Service
User Offline
Joined: 1st Apr 2005
Location: Earth
Posted: 8th Sep 2008 16:46 Edited at: 8th Sep 2008 21:52
My apologies - too much caffeine - I forgot to add x-axis *rotation* of the camera . Try this:



Note that I put the "Point Camera..." command *below* the "Position camera..." command - this is the reason why it was so jerky the first time - you can now remove the curvevalue commands if you want.

Also, if you want the camera to be straight behind/straight above the character object, try this code instead:



Hello World Tommorrow
ORLY
18
Years of Service
User Offline
Joined: 28th Aug 2006
Location:
Posted: 9th Sep 2008 08:44
Hey, no need to apologize..you are helping me after all

Everything works fine, thanks again for your help!

Login to post a reply

Server time is: 2024-09-27 20:29:57
Your offset time is: 2024-09-27 20:29:57