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 / CURVEANGLE, possible bug? or just me being thick!

Author
Message
Beta1
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location:
Posted: 6th Apr 2003 12:47


Now unless I'm missing something this should increment B# by 1 each loop until it reaches A#

If you run it what seems to happen is that B# is set to A# in one loop (ie only 100 is printed)
kevil
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 6th Apr 2003 13:03
Hehe, that's not the way it works.
The smooth value works different.
I think you can see it as the amount of steps to get there.
So if you want to add 1 each time (although it will get less each time I think)

B#=CURVEANGLE(A#,B#,100)

But I don't know if it will ever reach A#.

Kevil

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 6th Apr 2003 13:05
Yes, you are missing something. The last argument to curveangle is the number of steps you want to make, not the size of the step.

To get the 'increment by one' effect you expected, you have to continually decrease the 'step' value too.



So, not a bug after all?
Beta1
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location:
Posted: 6th Apr 2003 14:23
Cool then its just the docs being a little confusing again.

CURVEANGLE
This command will return an auto-interpolated angle based on a given speed. This command will gradually
move a number from its current value to a destination value at a certain speed. This command can be used
to create the technique of a camera swinging into position from another location by curving the value of
the camera angles. The parameters should be specified using real numbers.

SYNTAX
Return Float=CURVEANGLE(Destination Value, Current Value, Speed Value)

I read it to mean that the the speed value was the amount added/subtracted to the current value to move it towards destination per call of the command.
I guess it should be a called a "time value" really rather than a "speed value" as it directly defines the number of steps not the size the step.

kevil
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 6th Apr 2003 15:52
Well, if it was a speed value, it wouldn't be curved, right?
It would just be linear, which is easy to do yourself.

Kevil

Juso
23
Years of Service
User Offline
Joined: 23rd Sep 2002
Location: Finland
Posted: 7th Apr 2003 21:33
Kevil is right, curveangle acts in logarithmic not in linear way.
EddieRay
23
Years of Service
User Offline
Joined: 28th Feb 2003
Location: USA
Posted: 8th Apr 2003 01:44
The unfortunate part is that curveXXXX() functions work based on the number of times you call it... instead of how much time elapses between calling it. So in a normal game loop, when the frame rate drops, things start "curving" slowing, and when the frame rate speeds up, things start "curving" fast. Very hard to get useful results like "I want my tank to take 2 seconds to reach top speed"... of course, if the "speed value" was fully explained in the docs (exactly what is the forumla used, etc.), you might be able to adjust it every frame for how much time has elapsed since the last frame... but then if you are going to that much trouble, you might as well do the math yourself and skip using curveXXXX altogether.

Login to post a reply

Server time is: 2026-07-10 19:47:06
Your offset time is: 2026-07-10 19:47:06