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 / Making an object spin

Author
Message
I NEED HELP FAST !!!
17
Years of Service
User Offline
Joined: 9th Aug 2007
Location:
Posted: 15th Aug 2007 15:25
I need something like a plain ... spinning but not moving " not the texture spinning " the actual object please help ^^
Robert The Robot
18
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 15th Aug 2007 15:43
To set an object spinning in 3d space, try something like this:



Each cycle, you increase the size of the y-angle but always keep it between 0 and 360. Then you rotate the object about its y-axis by that angle.

You can change the speed of rotation by slipping in the Sync Rate command after Sync On, or altering the amount that the y# increases by each cycle.

Hope this helps.

BTW, if you want a plain, change the Make Object Cube command to Make Object Plain. I just can't remeber off the top of my head what parameters you have to specify.

On our way 'ome, on our way 'ome...
Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 15th Aug 2007 17:10
MAKE OBJECT PLANE object nr,size x,size z

Don't look at my sig!
I NEED HELP FAST !!!
17
Years of Service
User Offline
Joined: 9th Aug 2007
Location:
Posted: 16th Aug 2007 23:15 Edited at: 16th Aug 2007 23:17
im having a hard time implementing that code into the game .. it runs but it doesnt do anything all it does is reposition the object >_< this is wat i got tell me what im doing wrong haha






load image "light.bmp",1000
makeWall(210, 2000,1000, 0,80,35, 3815,-200,785, 1,0,1, 2,2.0,1.0, 1) : `East Train Wall
texture object 210,1000

ghost object on 210

do


y# = 360


y# = WrapValue(360+1)
YRotate Object 210, y#
sync
loop
Hangar18
18
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 17th Aug 2007 06:05
yes i can see the problem. Stick the y#=360 before the "do". i.e.

y# = 360

do
y# = WrapValue(360+1)
YRotate Object 210, y#
sync
loop
Comrade Robski
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location:
Posted: 17th Aug 2007 14:12 Edited at: 17th Aug 2007 14:14
There's still a slight mistake in Hangar's code

y# = wrapvalue(360+1) should be y# = wrapvalue(y#+1)

Edit: So the corrected code is:

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 17th Aug 2007 17:08
Glad someone spotted the "wrapvalue(360+1)" error as this would always return 1 as you are repeating the same sum, also there is no 360deg, degrees go from 0 to 359 (360deg = 0deg).

Quote: "MAKE OBJECT PLANE object #,size x,size z"

this is technically incorrect as Z is seen as the 3rd dimension, whereas planes are 2D objects. OK you are still only using 2 dimensions but I think "sizex, sizey" is less confusing.

Your signature has been erased by a mod because it was rubbish.
Insert Name Here
18
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 17th Aug 2007 17:19
Quote: "planes are 2D objects"

Untrue. If I hold a peice of paper, it seems 2D but of course we know it is 3D. A plain is just very very thin. You can still rotate and position it it 2D space.

(N-1)/n*100<n2/n-n/2+n/4*2+100
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 17th Aug 2007 17:25
Plains are 2D objects, they have no depth, you can see this from the parameters you give when creating them.
They consist of two triangles, and while they do exist in 3D space they themselves are 2D. Turn a plain sideways and it will be invisible!
I understand your paper example and the reason behind it is that genuine 2D objects are impossible in the real world, the closest we can get is drawing on a sheet of paper. Now imagine that you could draw a 2D object in mid-air; that is a plain.

Your signature has been erased by a mod because it was rubbish.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 17th Aug 2007 18:08 Edited at: 17th Aug 2007 18:11
Quote: "Untrue. If I hold a peice of paper, it seems 2D but of course we know it is 3D."


But a plain isn't a piece of paper!

A plain only has 2 dimensions. As OBese87 says, when you create one in DB, how many do you specify? Yep, 2.

Turn a piece of paper 90 degrees and you see the edge. Turn a plain 90 degrees and you see nothing as there's no edge to see.

Also, if it had three dimensions, it would get 'thicker' if you scaled it. This doesn't happen.

TDK_Man

Insert Name Here
18
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 17th Aug 2007 18:15
True, I can see your arguments. Though I would class a plain as 3D, because it can only exist in 3D space, not 2D.
Quote: "Also, if it had three dimensions, it would get 'thicker' if you scaled it. This doesn't happen."

It does have a depth, a depth of 0. No matter how many zeros you have, it will always be nothing. If it has absolutely no z-depth, how can we see it?
I suppose what you class it as just depends on who you are.
Anyway, I don't want to turn this thread into a debate about plains.

(N-1)/n*100<n2/n-n/2+n/4*2+100
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 17th Aug 2007 18:25
a depth of 0= no depth.

Your signature has been erased by a mod because it was rubbish.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 17th Aug 2007 18:32
Quote: "If it has absolutely no z-depth, how can we see it?"


We can't if we view it from an angle which only sees the depth - as there isn't any. To see a plain you have to view it from an angle that sees the X/Y surface.

As for a plain only existing in 3D space, in 2D they are called boxes.

Box X1,Y1,X2,Y2

...creates exactly the same thing as a Plain in 3D - something with only 2 dimensions.

If you add a third dimension to a 3D plain, it's not a plain any more - it's a cube (or 3D box)!

TDK_Man

Insert Name Here
18
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 17th Aug 2007 19:30
But if you have someing with nothing in one dimension, it isn't there!

(N-1)/n*100<n2/n-n/2+n/4*2+100
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 17th Aug 2007 22:02
Quote: "But if you have someing with nothing in one dimension, it isn't there!"

lol, in the real world that is true, but a computer screen doesn't require objects to have any depth at all.

Your signature has been erased by a mod because it was rubbish.
Insert Name Here
18
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 17th Aug 2007 23:07
"When relity isn't enough, we stimulate it"

(N-1)/n*100<n2/n-n/2+n/4*2+100
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 18th Aug 2007 00:12
Insert Name Here
18
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 18th Aug 2007 20:01
Oops. I'm sure that banner says "stimulate".

(N-1)/n*100<n2/n-n/2+n/4*2+100

Login to post a reply

Server time is: 2025-05-30 13:35:13
Your offset time is: 2025-05-30 13:35:13