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 / Help with 3D objects

Author
Message
Squall alias Leon
21
Years of Service
User Offline
Joined: 31st Jul 2003
Location: United Kingdom
Posted: 1st Mar 2004 15:18
Hello. I'm having a bit of trouble animating my little sphere. <y idea is to have 4 spheres move around in a circle, as well as increasing the Y value (so is like a DNA strand thing) ... but...

I can't remember the equation to make the sphere move around in a circle. For now I would just like someone to look at my source code and let me know how to rotate it around. The Y value will have the same equation so the ball rotates constantly around the point 0,0,0, as well as rises and falls. I'm rubish at maths. Can anyone help me?
hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 1st Mar 2004 15:55 Edited at: 1st Mar 2004 15:55
Not 100% sure but i think this code should rotate a sphere (object 1) around the 0,0 coordinate with an angle gain of g# (1.0) and a amplitude factor of f# (5.0).

rem calculate x,z values
f# = 5.0
g# = 1.0
a# = wrapvalue(a#+g#)
x# = f# * sin(a#)
z# = f# * cos(a#)

rem update object position
position object 1,x#,y#,z#

as for the y# position, if you want the object to just move up then you just add:

y# = y# + 1.0


Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 2nd Mar 2004 09:18
Or, you could use the NewXValue and NewZValue commands to do exaclty the same thing ( but without the need to know the math )...



( I know, it's exaclt the same code, but it's a bit easier to understand for some people than using sin and cos... )

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy

Login to post a reply

Server time is: 2025-05-22 19:21:29
Your offset time is: 2025-05-22 19:21:29