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 Professional Discussion / How can I get a third point on a line?

Years of Service
User Offline
Joined: 19th Apr 2016
Posted: 19th Apr 2016 22:05
In a 3D world with planes x,y,z,. Y is the height measurement. X and Z are "floor". Right now I am working on a pause ability for my game. I have arrays that hold the position of the object(me) and the angle of the object(me). I also have arrays to hold the position and angle of the camera following me. For my pause ability, when the 'p' button is pressed it records the current positions and angles for me and the camera and then deletes all existing objects. Then I have it go to another subsection of code via the 'gosub' command. Once I am done in the "pause menu" I use another 'gosub' command to get it to go to the place where it creates my game and positions and points the object. Problem is, I can't figure out how to get it to point the same direction as before. I got it to create the object in the same position, just can't figure out how to make a third point on the line. I use the object and camera positions to get a slope using point-slope formula. My camera is following a hidden object because my game is first person and I didn't know how to apply a collision box to a camera(if that is even possible). I'm just wondering if there is a better way to "pause" the game or how to get a third point on the line of my camera/object line to point my object at. I will attach a copy of my code and images so you can compile the code.


Login to view attachments
Green Gandalf
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 20th Apr 2016 17:23
You haven't included your code or images, only the dbpro file.

Not quite sure what you mean here: "I can't figure out how to get it to point the same direction as before". What is "it"? You've used "it" several times to refer to different things I think. In this case I assume you mean the camera.

Powered by Free Banners
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 20th Apr 2016 23:20 Edited at: 21st Apr 2016 00:04
I really don’t see the need to delete and rebuild your objects and camera just to implement a pause feature in your game. So, I would go with the better way. One thing I would suggest to anyone starting a project is to learn how to use the – Select, Case, Endcase and Endselect commands.

This snippet is just a simple 2-D demo of circles moving around the screen. This same principle will work with 3-D and a pause menu as well.

Edit: Press “p” to pause/resume.

Login to post a reply

Server time is: 2018-07-16 06:04:32
Your offset time is: 2018-07-16 06:04:32