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 / Yrotate object slowly,can it be done

Author
Message
Daniel wright 2311
User Banned
Posted: 28th Nov 2011 04:51 Edited at: 28th Nov 2011 04:56
Ok,so this makes sense ill start off by saying I am making a frogger game,its looking real cool so far,its in 3d.

I have my frogger with all the move commands so far but here is a problem I am having. When the frog turns it is a instant turn at 90 degrees. I want people to see the frog jump and turn in a 90 degree movment and not a instant turn. here is how I am making him turn.Any help is always apreshiated.



my signature keeps being erased by a mod So this is my new signature.
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 28th Nov 2011 05:31
Here is one way that you can do it:



This places the camera above a green cube. When you hit the right arrow key is rotates around the Y axis to the right; same for the left arrow key.

Hope this helps you.


Daniel wright 2311
User Banned
Posted: 28th Nov 2011 06:03
Hey that worked well, thanks, now thay i look at it it makes good sense.

my signature keeps being erased by a mod So this is my new signature.
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 28th Nov 2011 06:22
Okay, great.

FYI, you can increase the speed of the rotation by changing the amount of angle difference from 2 to anything that will divide evenly into 90. So if you add / subtract 5, for example, from the current Y angle instead of 2, it will rotate quicker.


Daniel wright 2311
User Banned
Posted: 28th Nov 2011 07:20
Quote: "FYI, you can increase the speed of the rotation by changing the amount of angle difference from 2 to anything that will divide evenly into 90. So if you add / subtract 5, for example, from the current Y angle instead of 2, it will rotate quicker."


Ok,I see, what I wanted was when I push the right key one time the whole frog turns all the way around and a 90 degree turn slowly. It was I had to hold the right and left key,But I used your code and did this,and it works great.I will play around with it more.



my signature keeps being erased by a mod So this is my new signature.
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 28th Nov 2011 16:24
Can someone explain wrapvalue please

Cybermind
Valued Member
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 28th Nov 2011 16:34
Wrapvalue will take a value and make sure it stays within 0 to 360. For example, the variable turn_something is added 10 each loop, so at first it is 0, then 10, then 20, then 30, and when the variable has reached 360 it will wrap the value back to 0 then go all the way up to 360 again and wrap back. This also applies the other way so when you come, example, from 55 and subtracts from that value until it reaches 0 it will wrap back to 360 and continue.

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 28th Nov 2011 16:37
Wrapvalue is used to make sure that the angle stays within legal bounds, which is 0.0 to 360.0. By using it, if the angle were to go negative, for example, it would add 360.0 to it to come up with the correct angle. Same applies if the angle is greater than 360.0.


MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 28th Nov 2011 17:39
Thanks guys

Login to post a reply

Server time is: 2026-07-10 01:59:31
Your offset time is: 2026-07-10 01:59:31