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.

Newcomers DBPro Corner / New to Games Programming - Help with 3D concepts

Author
Message
Martin
21
Years of Service
User Offline
Joined: 3rd Dec 2002
Location:
Posted: 11th Dec 2002 11:43
I have been programming applications for many years but want to play in making games. It's got to be more fun than my day job.
DB seems ideal for this but I am having a bit of trouble getting my head around the 3D concepts.
I am trying to simply get a ball to bounce around inside a cube, where when it hit's a wall of the cube it bounces off at the relevant angle. I don't want any gravity involved so I feel it should be simple.
I started off having 5 objects for the top, bottom, sides and end of this box with the camara positioned at the other end, and on clicking the mouse, launch a sphere off in the direction the camara is facing, for it to bounce of the top/bottom/sides and stop at the end.
The stopping at the end and coliding with the top/bottom/sides is not problem, but I can't figure out how to make it appear to 'bounce off' the walls it hits.
I have tried lot's of things and just got confused.
Any ideas/examples greatly received.

Additionally, are there any good books I can buy for Dark Basic??
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 11th Dec 2002 12:42
Well unfortunatly in our infinate wisedom, non of us have written any yet ... some here should write some sorta concepts book thou - perhaps some of the better coders like Shiven, Uwdesign, GuyS

make an interesting read hehee

what i'd do if i were you is look into a more general terms, of 3D Math - suchas Trig and the use of Vectors within programming.
There are many sites for games programming, and for some reason they all illude my memory so i'll be back later once i remember hehee - unless someone can actually remember things for more than 5seconds will post some up

I could explain the concepts easily however, both would be different depending on whether your using DarkBasic Standard|Enhanced|Professional

Anata aru kowagaru no watashi!
Martin
21
Years of Service
User Offline
Joined: 3rd Dec 2002
Location:
Posted: 11th Dec 2002 12:59
Thanks, anything would be a help.

I am using DB 1.1 I think?? I don't have it here at work. I bought the old DB and Dark Matter bundle. It was about 3rd of the price of DB Pro and I thought would be a good way to see if I can transfer skills from Applications Programming to games.

The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 12th Dec 2002 00:01
To get an object to bounce off a wall, simply reverse the velocity which is acting at right angles to the wall. For example, if the ball is moving with x velocity of 5, and it hits a vertical brick wall then the y velocity will not change (unless there is friction and the coefficient of restitution which you probably needn't bother with), so the y velocity will remain constant and the x velocity will be -5.
Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 12th Dec 2002 03:19
a ball bouncing in a cube:


sorry `bout the camera being rather keraaap but i believe u just wanna see the bouncy thing.
Martin
21
Years of Service
User Offline
Joined: 3rd Dec 2002
Location:
Posted: 12th Dec 2002 11:21
Thanks for these replies.

Flashingblade : Thanks so much fo this. It's a great help.

TheDarthster : I was using the 'Set object to camera orientation' and 'Move object' commands on the sphere, so figured that when it hit a wall, I was reversing the velocity as you said, but as I was using 'Move object' I had to point it again as the orientation was not now the same as the camera. I was trying to us 'Point Object' for this.
Basically, I think I was just getting myself in a bit of a mess. It's just a case of approaching things the right way I guess. The Code Snippet from Flashingblade has made me look at it a different way. Back to the old drawing board.

Thanks again guys.

Login to post a reply

Server time is: 2024-04-12 22:52:23
Your offset time is: 2024-04-12 22:52:23