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.

DarkBASIC Professional Discussion / 3rd person shooter shoulder camera

Author
Message
TheConnorian
16
Years of Service
User Offline
Joined: 18th Dec 2009
Location: I\'m in ur game, pwning ur noobs
Posted: 20th May 2011 22:58 Edited at: 20th May 2011 23:00
I need help with a small piece of code to create an over the shoulder camera, like in red dead redemption, gears of war and other games. It seems to be a good angle for rpg games (gears of war isn't one in case someone tries to point that out) however the code snippet which I pinched from the forums isn't giving me the continous over the shoulder camera I would like.

Heres the code



and if possible explain so that both I and other viewers can fully utilize your intellectual help but I can understand if you don't feel bothered. thanks to anyone who can help.

edit:
please note that I have tried doing some things with the code myself not just expected the code to magically do what I want.
Daniel wright 2311
User Banned
Posted: 20th May 2011 23:06
This is what I do, this way you can set the values to mach the position any where you want, just set the smooth to a low value.



my signature keeps being erased by a mod So this is my new signature.
TheConnorian
16
Years of Service
User Offline
Joined: 18th Dec 2009
Location: I\'m in ur game, pwning ur noobs
Posted: 20th May 2011 23:57
Tried it don't know what I'm doing wrong but it simply ain't working, It ends up just focusing on the central cube and I KNOW I haven't got the object numbers wrong or the camera won't move. I mean if I could integrate this function in I would cause I love functions (used to be all about gosubs). Could you explain a bit more or someone suggest another route.
Daniel wright 2311
User Banned
Posted: 21st May 2011 09:54
Did you put the function in the loop then put in the object number you want to follow with in the function?

what did not work right?

Show me some code of yours so we can understand what to help you with, show us in your code how you are using this function so we can see why it will not work.

my signature keeps being erased by a mod So this is my new signature.
TheConnorian
16
Years of Service
User Offline
Joined: 18th Dec 2009
Location: I\'m in ur game, pwning ur noobs
Posted: 21st May 2011 13:43 Edited at: 21st May 2011 17:29
ok I have it working like this:



but I'm pretty sure that this isn't what I wanted, plus the function doesn't seem to be doing anything different or be capable of doing anything different. The over the shoulder cam I am looking for just seems to be out of reach for the moment.

edit:
ok I got it working, fiddling around and it just popped into place. So with this it follows the camera and has a nice smooth bounce back however the turning is jumpy, anyway that can be smoothed out?

but anyway heres the code, also added a sprint feature so that by pressing shift you move faster:

Daniel wright 2311
User Banned
Posted: 21st May 2011 23:11
You can smooth it out with the s# value, keep it low so the camera stays always with the camera, keep it high if you want the camera to fly around before it positions its self to the object.

my signature keeps being erased by a mod So this is my new signature.
TheConnorian
16
Years of Service
User Offline
Joined: 18th Dec 2009
Location: I\'m in ur game, pwning ur noobs
Posted: 21st May 2011 23:25
thanks, do you know anyway of coding it so that the camera is slightly to the right of the object?
Daniel wright 2311
User Banned
Posted: 21st May 2011 23:38
Thats all in positoning the camera after the fact, in the same code position camera the way you want it positioned. like this

function positioncameratoplyr(obj#)
x#=object position x(obj#)
y#=object position y(obj#)
z#=object position z(obj#)
a#=object angle y(obj#)
d#=35.0
h#=40.0
s#=4
set camera to follow x#,y#,z#,a#,d#,h#,s#,1

position camera ,x#,y#,z#-10 rem this is where we try to reposition the camera, unteasted, there is probely a better way

OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#

oldx# = object position x(obj#)
oldy# = object position y(obj#)
oldz# = object position z(obj#)

endfunction positioncameratoplyr

my signature keeps being erased by a mod So this is my new signature.
TheConnorian
16
Years of Service
User Offline
Joined: 18th Dec 2009
Location: I\'m in ur game, pwning ur noobs
Posted: 22nd May 2011 00:05
I've tested and it doesn't seem to work at all. So I made this code it gives almost what I want however it causes a odd camera problem when you turn the way your facing. I have only added +5 onto the x#.

Daniel wright 2311
User Banned
Posted: 22nd May 2011 00:10
Yea, thats probebly the true way I would have done it,keep messing with the values , its all in trial amd error till you will get what you want.

my signature keeps being erased by a mod So this is my new signature.
Southside Games
16
Years of Service
User Offline
Joined: 1st Jan 2010
Location: Don\'t tell me what to do!
Posted: 5th Aug 2011 19:57
did you get it to work? I'm looking for a over the shoulder thing to
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 5th Aug 2011 21:54
Try this...you can smooth the camera and let camera position on both sides of your soldat.



Cheers.

I'm not a grumpy grandpa
Southside Games
16
Years of Service
User Offline
Joined: 1st Jan 2010
Location: Don\'t tell me what to do!
Posted: 18th Aug 2011 19:09 Edited at: 18th Aug 2011 19:14
you know what I do is make an object, hide it, and moved it over to the right, for some reason objects have the command "move object right/left" wail the camera does not. so I position the object on the player object then use "move object right follow object,distance disired" then use the set camera to follow on that object, or




this will need some tunning for your needs. but you should get the picture

Login to post a reply

Server time is: 2026-07-11 03:38:11
Your offset time is: 2026-07-11 03:38:11