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 / Rolling Ball Code

Author
Message
Hop a long
19
Years of Service
User Offline
Joined: 12th May 2004
Location: The Code Dump
Posted: 24th Jun 2004 04:01
I seem to remember a thread about trying to code a rolling ball. Someone had posted a code snippet for rolling on one axis. I don't recall if the solution for x and z axis movement was found. A search doesn't turn up anything. I remain clueless. Any hints?
Surreal Studio IanG
20
Years of Service
User Offline
Joined: 21st Sep 2003
Location: Cyberspace...I think
Posted: 26th Jun 2004 14:30 Edited at: 26th Jun 2004 14:31
why dont u move it and rotate it manually or get one of the physics dlls like newton u could probable call the command from the dll manually or something

PC Spec- AMD Athlon 2.0Ghz, GeForce FX5200 128mb, 512MB of ram, Win XP Home SP1

Error 0 = no error - how is this an error the???
Hop a long
19
Years of Service
User Offline
Joined: 12th May 2004
Location: The Code Dump
Posted: 26th Jun 2004 18:30
Thanks Phoenix
I appreciate your reply. This thread seemed destined to die unanswered. Sometimes I think I enjoy the coding more than the final game. I can break the routine into move and rotate for both x and z. But unless the rotation is 180 degrees the second axis is missaligned for its turn. The ball will go where it is supposed to
but the texture shows it is rotating a different way. I tryed the Fix Pivot Command but might not be calling it at the right moment.
Surreal Studio IanG
20
Years of Service
User Offline
Joined: 21st Sep 2003
Location: Cyberspace...I think
Posted: 26th Jun 2004 18:36
i wish i could help more, but i ve only got DBPro

PC Spec- AMD Athlon 2.0Ghz, GeForce FX5200 128mb, 512MB of ram, Win XP Home SP1

Error 0 = no error - how is this an error the???
Hop a long
19
Years of Service
User Offline
Joined: 12th May 2004
Location: The Code Dump
Posted: 26th Jun 2004 19:40
Thanks just the same. Good Coding!
Drew Cameron
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location: Scotland
Posted: 26th Jun 2004 22:10
I've had a similar problem >
I hate the DB rotate commands...

<img>http://www.ddrw.dbspot.com/new/banner.jpg</img>
Dr Crazy
20
Years of Service
User Offline
Joined: 13th Apr 2004
Location:
Posted: 27th Jun 2004 13:27
Hey I got an idea! If you are MOVING the ball you could make an illusion so it LOOKS like its rolling but ISNT. Have you tried scroll object texture? Here's an example:

I hope it helps

Who dares; wins.
DeepBlue
20
Years of Service
User Offline
Joined: 17th May 2003
Location: A little box in the UK
Posted: 27th Jun 2004 13:42 Edited at: 27th Jun 2004 13:46
That was my old rolling ball

Here it is again



It was originally done to show something else guess I ought to update it to change direction.

[Edit] I'll try to update it asap, but not feeling well at the moment, recovering from hospital operation [edit]

The coder formerly known as Twynklet.
DeepBlue
20
Years of Service
User Offline
Joined: 17th May 2003
Location: A little box in the UK
Posted: 27th Jun 2004 17:12
Damn DBP & rotation is messed up, found some old code I done for DBC that works fine for this in DBC (bit messy)



Just spent 3hrs trying to work out why it won't work correctly in DBP, apart from the fact that it seems the rotation is inversed if you do a zrotate ( oh well least the new code i've done looks nice lmao )

Now have it rotating by the correct amount perfectly on each axis if I only rotate around one axis (i.e if travelling at 45 degrees to an axis it rotates at half the speed it would if travelling across it ) If I try any method of roating around the two axis X & Z the whole thing throws a fit.

I'll put it down for a bit or i'll have to go kick the cat.

The coder formerly known as Twynklet.
Hop a long
19
Years of Service
User Offline
Joined: 12th May 2004
Location: The Code Dump
Posted: 27th Jun 2004 19:52 Edited at: 28th Jun 2004 03:49
Yo Gents! Thanks to one and all. These snips have really got me going. There's a lot of information to digest here. Give me a moment to chew and swallow. By the By Deep Blue if that's how you code after a stay in the hospital, it's time for me to get sick.
Hop a long
19
Years of Service
User Offline
Joined: 12th May 2004
Location: The Code Dump
Posted: 30th Jun 2004 09:46
SAS Elite Pvt Rakosi I admire your "out of the box" thinking. That solution would never have occured to me. I've spent some time with the idea and discovered many useful effects I'd like to develop further. But getting the texture to rotate seems to require math similar to getting the ball to rotate. So for now I still working on spinning the ball. Many Thanks.

Deep Blue you have a fine grasp of the problem. Your code is beautifully written. The logic is clearly seen with the variable names you choose. You come directly to grips with the math. I didn't expect that. I too used the circumference formula to calculate the linear distance of movement per degree of rotation. But I relied heavily on DB Commands as the code should show. I think my code more imitates rolling than actually explains the math.


I would like to put the code on my website along with the thank you for your help. If you have a preference one way or the other please let me know.
DeepBlue
20
Years of Service
User Offline
Joined: 17th May 2003
Location: A little box in the UK
Posted: 30th Jun 2004 10:01
Glad to see you found what u wanted

Lmao still never got my code to work in DBP (neither does yours btw same problems), but they both work perfectly in DBC

Thnx for the compliments btw, do whatever ya like with my code if it helps someone else its fine by me.

Guess I should get back to writing my rpg...nope cant be bothered think I'll squander my life on the forums for a bit

The coder formerly known as Twynklet.
Hop a long
19
Years of Service
User Offline
Joined: 12th May 2004
Location: The Code Dump
Posted: 2nd Jul 2004 06:44
Thanks for the OK to post your code. I think you came up with an interesting solution to an interesting problem. I hope others will find the web page interesting as well.http://www.geocities.com/hifin2003/deepblue.html

Login to post a reply

Server time is: 2024-04-28 18:02:28
Your offset time is: 2024-04-28 18:02:28