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 / "set camera to follow" doesn't finish its job

Author
Message
Orbi
21
Years of Service
User Offline
Joined: 11th Sep 2003
Location:
Posted: 14th Sep 2003 16:01
I made it so when a key is pressed (e.g. "2"), the camera goes to a given coordinate. I only want it to do this when certain keys are pressed, while at other times it can be controlled by other keys (arrows) and the mouse.
So to allow both things to happen I placed the "set camera to follow" command inside an if statement. I solved most issues but one remains: The camera will only go to the given coordinate if I hold down the key ("2" in this case). Otherwise it just moves a little towards the given coordinate.


So the question is: Is there a way of having this command inside an IF statement and then waiting until the target coordinate is reached?

I tried doing this with loops and waits but it doesn't seem to work.

and another minor question: Is there a way to have the camera do the follow command in a linear motion instead of this inverse exponential or bezier or whatever it is?
CodeOrc
21
Years of Service
User Offline
Joined: 13th Sep 2003
Location:
Posted: 14th Sep 2003 19:25
I have been working on a multi-camera system myself. See the code in this post.

A different camera behaviour is invoked depending on the key pressed. The views used are of course my own style of like, but feel free to use the code and edit it any way you see fit.

btw, the code resides inside the Do Loop part of the proggy.
Have fun
Orbi
21
Years of Service
User Offline
Joined: 11th Sep 2003
Location:
Posted: 14th Sep 2003 19:44
The real problem here is getting that code to work with the mouse view. But I managed to solve the problemo. The code's a bit of mess right now but it involves setting a flag every time the auto movement key is pressed (like "2" in my example). That flag allowes the follow command to execute via an if statement which also has a nested if that checks if the target position and angle are within required bounds. Once the bounds are reached the flag is reset and the mouse view variables are reset to the new values.

So now I push the numbers to take me smoothly to coordinates and once there I can look around with the mouse and even move around with arrow keys. YAY!

Login to post a reply

Server time is: 2024-11-25 08:49:53
Your offset time is: 2024-11-25 08:49:53