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 / how do you make a camera turn slowly toward a point?

Author
Message
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 28th Jul 2009 23:03
i know u use wrapvalue but i dont know how to code this.i want to make a cut camera.
Kira Vakaan
15
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 29th Jul 2009 00:31
If I understand your problem, I don't think you need wrapvalue(). Look up the commands curvevalue() and curveangle(). For this I think you want curveangle() because it does the wrapping around 360 for you. What these commands do is return a number in between the given destination and current values based on the given speed value.

Syntax:
curvevalue(Destination, Current, Speed)

Returns:
Current+(Destination-Current)/Speed

You'd put this in some kind of loop like so:

Of course, that's only around the Y-axis, but hopefully you get the idea.
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 29th Jul 2009 02:08
thanks ill try that
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 30th Jul 2009 22:52
well... it would be easy to do if you just wanted to rotate an object to a given angle slowly. But you want an angle to point towards a point.

Heres the function i use. If you want to understand the math in the, search "Vectors don't bite" on the forums. Otherwise, just use it .

Basically, x and y is the position of your object. x2 and y2 is the position you want your object to point towards, angle is the angle of your object, and anglespeed is how fast you want your object to turn.



Y values are interchangeable with Z values, so don't worry about that.

An example using this code would be...

yrotate object 1, object angle y(1)+get_deltatheta(object position x(1), object position z(1), object position x(target), object position z(target), object angle y(1), 30)

If you repeated that ccode over a loop, object 1 would point towards object target. The returnvalue from the function isn't what angle the object needs to be at, but how uch the object needs to turn.
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 30th Jul 2009 23:16
will someone give me code to make my camera move to a point & slowly turn to point a xyz i want??

Login to post a reply

Server time is: 2024-11-24 04:55:33
Your offset time is: 2024-11-24 04:55:33