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 / Third person controls relative to camera

Author
Message
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 13th Jan 2013 00:50 Edited at: 13th Jan 2013 01:04
Hey folks,
I'm trying to make my character run using the arrow keys, with the actual direction depending on where the camera is moved. I'd like the camera to move in real time too so this is somewhat important.

I've been able to get the character to move toward the camera using the following code:

But have been unsuccessful at being able to make him run the opposite direction (away from the camera) or left or right.
Any help would be appreciated.


EDIT
I should mention, obviously I could just move the object at a negative value, but then my character would be walking backwards. I'm sure there's a fairly simple solution to this that I just can't come up with at the moment.

http://mattsmith.carbonmade.com/
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 13th Jan 2013 05:21
Nevermind, I got it working. It doesn't exactly follow the camera, but I'll post what I'm using in case anyone finds it useful.


http://mattsmith.carbonmade.com/
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 13th Jan 2013 06:14
Have a look at the SET CAMERA TO FOLLOW command



Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 13th Jan 2013 06:17 Edited at: 13th Jan 2013 06:21
This is a neat idea!
Here's a more efficient version:


When you find yourself writing lots of very similar lines try to look for ways to combine them. I'll give you that this one was tricky though, angles are difficult.

@Valentine
Quote: "Have a look at the SET CAMERA TO FOLLOW command"

Wattywatts wants the player to move in relation to the camera view, not have the camera follow the player. It's a nice command though and is not used enough.

Shh... you're pretty.
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 13th Jan 2013 08:28
Quote: "Here's a more efficient version:"

Gonna have to agree here. This is the better method. Although you might have to tweak the speeds.

SET CAMERA TO FOLLOW is great, but too little control.

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 13th Jan 2013 20:15
Hey thanks OBese! Now if I could just get the collision working..the bane of all my programming forays.

http://mattsmith.carbonmade.com/

Login to post a reply

Server time is: 2026-07-07 05:15:15
Your offset time is: 2026-07-07 05:15:15