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 camera with an offset

Author
Message
Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 20th Jan 2014 00:34 Edited at: 20th Jan 2014 00:37
What's going on everyone, I am trying to make a 3rd person perspective camera. Sure it was easier than putting on socks after you wake up, but I want to offset the camera at a user defined position.

The best explanation I have would be that with a big enough offset, moving mouse left or right would essentially move camera forward and backwards. To help explain my problem I drew two figures and attached image here.

Figure 1 display a normal 3rd person view camera, Figure 2 display what I am trying to accomplish.

Anyone have an idea? Maybe it is a piece of cookie for you, but I was trying for a while and can't figure it out . I'm going now to poop and will think about it some more meanwhile.



edit: attach sample code as well

Attachments

Login to view attachments
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 20th Jan 2014 01:04
Just to clarify, you want to offset the camera but where's the camera pointing. For instance, take Fig 1, if you offset the camera left the camera would still be pointing in the direction of the box. Now this is where I'm confused because in Fig 2, the cameras are pointing at the offset points. So do you want the camera to offset as if it was strafing or offset from a newly desired point that's already offset from the box?

"Get in the Van!" - Van B
Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 20th Jan 2014 01:26
While sitting in the bathroom I realized there was a command in matrix1 dll called "Move Camera Right". I tested it, and it gave me the result I wanted

To answer your question:
I wanted the camera to offset at an position while still keeping the camera movement (rotation from mouse input) ratio of a non-offset camera position as in Figure 1.
To further clarify, if you have matrix1 dll's installed you may run this code example:



Anyway it would be interesting to know how to achieve this effect without relying on external dll -_-
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 20th Jan 2014 01:37
I see. Well you can use Offset Limb for directional offset based off of the objects angle, example:



Another way to do it is to multiply the objects look/right and up vectors by the offset amount and add them to the objects position. The result will be the camera position. This is if you prefer a more math based approach. Either way, there are a few methods to do this.

"Get in the Van!" - Van B
Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 20th Jan 2014 01:54
That was a nice method that you used. It never occurred to me to use an objects limb for this effect.

Nevertheless, I will probably use this matrix1 dbpro command because it's just one line of code

Login to post a reply

Server time is: 2025-05-15 23:55:41
Your offset time is: 2025-05-15 23:55:41