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 / camera problems :)

Author
Message
Static
20
Years of Service
User Offline
Joined: 4th Apr 2004
Location: United Kingdom
Posted: 26th Oct 2004 21:46
Hi i was wondering if anyone could help me out here . I'm trying to create a camera function that uses the mouse to move around the character when he is stationary but that when he is moving the mouse makes the character turn and the camera follows behind him kind of like in fable. I'm ok when it comes to the moving bit but when he is stationary I'm having troubles. I'm on holiday and in an internet cafe now so i cant test it out. I'll be on for another 25min and probably in a day or 2. any ideas would be good.

ps: i would post the code but i dont actually have it on me.
Static
20
Years of Service
User Offline
Joined: 4th Apr 2004
Location: United Kingdom
Posted: 26th Oct 2004 22:11
got to go in 2 min but here is my code so far. If anyone could fill in the gaps i would be gratefull. I'll check this post in the next 2 days so you're ideas wont be wasted

Bona
19
Years of Service
User Offline
Joined: 22nd Oct 2004
Location:
Posted: 27th Oct 2004 01:02
Your problem shouldn't be to hard to fix.
Make it like this.

If upkey()=1 then move#=1 else move#=0

when move#=1 you just use the coding that makes the charakter turn.
When move#=0 then you make the mouse just make the camera wrap

The only way to get an intellegent conversasion is to have a monolog.
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 27th Oct 2004 05:02
Here is some code that should do what you want. It took me longer than expected to get it right...



That is what you wanted, right?

Xander Moser - Bolt Software - Firewall
Static
20
Years of Service
User Offline
Joined: 4th Apr 2004
Location: United Kingdom
Posted: 28th Oct 2004 03:51
Thanks it looks good to me. haven't been able to test it yet but looked through it and the only thing i didn't get was the abs bit:


could anyone explain it too me
thanks
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 28th Oct 2004 09:50
This just checks if the difference between the values is >180. abs means absolute value. That is the distance from zero that the number is. Basically, it will just take off the negative sign if there is one.

That part of the code may seem a little excessive, but I did it so that the player does not turn the wrong way. i.e. if he is turned 10 degrees and the camera is at 5 degrees, he doesn't turn all the way around, he just turns the other way. Get it?

I hope it works out.

Xander Moser - Bolt Software - Firewall
Static
20
Years of Service
User Offline
Joined: 4th Apr 2004
Location: United Kingdom
Posted: 29th Oct 2004 18:32
It's going well but i can't figure out why this code doesn't work and how to fix it:


The only problem with it is this part:


it wont rotate all the way round it just stops at 4 degrees.

Thanks
Static
20
Years of Service
User Offline
Joined: 4th Apr 2004
Location: United Kingdom
Posted: 29th Oct 2004 19:07
I tried this but it didn't work either:
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 30th Oct 2004 01:15
You are using the point camera command after manually rotating it. This will cancel out the angle of the camera that you set. What are you trying to accomplish with this code (I can't test it out right now, sorry)? Tell me what you want to do and I will write up a little code for it.

Xander Moser - Bolt Software - Firewall
Static
20
Years of Service
User Offline
Joined: 4th Apr 2004
Location: United Kingdom
Posted: 31st Oct 2004 19:46
It's ok i've managed to get it right myself
thanks for your help
Static
20
Years of Service
User Offline
Joined: 4th Apr 2004
Location: United Kingdom
Posted: 3rd Nov 2004 04:00
I was just wondering. How come the following code only works if the control and camera functions/subroutines are called using gosub and not as a user functions. The code compiles but the camera wont rotate around the stationary box.

using gosub:


using user functions:


I'm just curious to know why it doesn't work because i though gosub subroutines were the same as user defined functions.
Thanks
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 3rd Nov 2004 08:12
I really don't know...to tell you the truth, I never made a function in my entire life. I always just define a few variables, then use a gosub. That's what everyone should do...

Xander Moser - Bolt Software - Firewall

Login to post a reply

Server time is: 2024-09-23 04:24:18
Your offset time is: 2024-09-23 04:24:18