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 / 3rd person camera trouble

Author
Message
Spectre 117
14
Years of Service
User Offline
Joined: 18th Apr 2010
Location: *Insert cheesy location here*
Posted: 20th May 2010 20:05
so I want to use a 3rd person camera similar to star trek online, where the camera follows the object but is positioned sightly above it. I have tried to achieve this effect on my own but have failed. Whenever I try to position the camera above the object the camera tends to drift when I roll/pitch/turn the object. So if anyone understands what I am talking about and could help I would really appreciate it.
owlman
15
Years of Service
User Offline
Joined: 8th Apr 2009
Location: Italy
Posted: 20th May 2010 20:50
hi Spectre - in 'set camera to follow' there's a parameter that states how smoothly you want to follow ...

if effort>reward : gosub home : endif
Spectre 117
14
Years of Service
User Offline
Joined: 18th Apr 2010
Location: *Insert cheesy location here*
Posted: 20th May 2010 21:49 Edited at: 20th May 2010 22:15
Nevermind, I think I figured it out. The camera movement is not as smooth as I would like it, but it will work for now.
zeroSlave
15
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 20th May 2010 22:00 Edited at: 20th May 2010 22:58
How about this:


In this code, it's all about the:


Some pretty tasty math in there!

My green thumb grew the tree my Trojan War horse was crafted from. With roses in our pockets we rally round the tombstones. Ashes to ashes, we all fall down.
Spectre 117
14
Years of Service
User Offline
Joined: 18th Apr 2010
Location: *Insert cheesy location here*
Posted: 20th May 2010 22:54
CoughMist, Thanks for the codes. The last one looked promising but I couldn't get the camera to follow the object. Take a look at my last post, I just edited it and posted the revised code. The camera is not very smooth , but its the effect I am looking for. Thanks
zeroSlave
15
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 20th May 2010 23:14 Edited at: 20th May 2010 23:16
If your object ID is 13 You could try this:



Just happy to try and help. Glad you were able to sort it out on your own!

My green thumb grew the tree my Trojan War horse was crafted from. With roses in our pockets we rally round the tombstones. Ashes to ashes, we all fall down.
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 18th Jul 2010 04:30
I found a really easy way

the (1)s replace with (your object id)

I want coke, not Pepsi!
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 23rd Jul 2010 17:59 Edited at: 23rd Jul 2010 18:01
@Spectre 117:

Here is your code with smoothness added. I used the curvevalue command, which smoothly moves one number to another. Basically what the code does is record the camera's current position, wherever it may be. Then it puts the camera where it's supposed to be (behind the object) and records that position. Then, using the curvevalue command, it smoothly transitions the camera's coordinates from the current coordinates to the coordinates it's supposed to be at. Curveangle does the same thing as curvevalue, only it does it for angles. The code then records these "transitioning" coordinates in some variables and then puts the camera there.

NOTE: Because of some weird rotating issue, the PITCH CAMERA UP/DOWN commands didn't work with smoothing (there was some weird sudden jerkiness). So I changed them to use xrotate camera instead. Pitching the camera up by 90 degrees is the same as subtracting 90 degrees from the camera's current x angle. Pitching it down is the same as adding 90 degrees. Keep in mind that the TURN OBJECT LEFT/RIGHT commands may also cause similar problems. This can be fixed by using the yrotate object command instead.

Anyway, here's the modified code with smoothing. It's commented to make it easier to understand. The variable names are also really long to make things easier



I hope this helps

EDIT: Or you could just use SET CAMERA TO FOLLOW for smoothness as someone mentioned earlier.


Guns, cinematics, stealth, items and more!

Login to post a reply

Server time is: 2024-11-24 13:51:26
Your offset time is: 2024-11-24 13:51:26