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 Discussion / Rotate object problem using OBJECT ANGLE (DBC) help pls ?

Author
Message
Newbie5UK
20
Years of Service
User Offline
Joined: 13th Nov 2004
Location:
Posted: 6th Feb 2006 21:48
Hi, I have a sphere rotating using

YROTATE OBJECT 1, OBJECT ANGLE Y(1) + 0.1

in increments of 0.1 of a degree.

With 1 degree incrments it works, with anything less I get
"runtime error, specified angle mus be 0 to 360 degrees"

I have tried using some checks, but as Y(1) is not a variable, I'm not sure how to reset to 0 degrees and not exceed 360... any help ?
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 6th Feb 2006 22:17
You can use the "wrapvalue(number)" command to convert the number to 0 to 360 no matter how big or small the number is.


Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 6th Feb 2006 22:18 Edited at: 6th Feb 2006 22:18
use the Wrapvalue command.


For n = 1 to 1000
Wrapvalue(object angle y(1) + n)

Next n

Newbie5UK
20
Years of Service
User Offline
Joined: 13th Nov 2004
Location:
Posted: 6th Feb 2006 23:14
Hi, so I used this..

YROTATE OBJECT 1,Wrapvalue(object angle y(1) + n)
n=n+0.2

As I want to put in a continuos game loop.. it's a planet so I want it to rotate smoothly, btu slowly..

Not sure if I am using it correct as i nsyntax, but it works with n=n+1, but again with smaller amounts (for smoother rotation and slower) is doesn't work.. this time it doesn't rotate unless n=n+1..

Please advise

Login to post a reply

Server time is: 2025-05-23 17:11:57
Your offset time is: 2025-05-23 17:11:57