Creating a 3D game, need some assistance
-
How would I convert a point on a circle to a point on a line? 🤔 This is for my 3D project that I am making. Things that are behind the player still render on the screen, which is a problem.
(I'll probably find a way, just asking in case anyone knows right now.) -
@RobinsonX What are we given? Like do you know the coordinates of the point on the circle, or just the radius of the circle and the angle the point is at?
-
If you know the angle from the centre of the circle to the point for some reason, then:
position along the line = radius of circle × cos(the angle)
You may want to experiment with the angle, adding maybe +90 or -90 or something to "the angle" because hyperpad's angle system always messes me up and I'm not sure exactly what you might need to add.
-
I'm not sure how your 3D works, but do you produce x y and z coordinates? The way mine works is you are rotating the actual object which changes each point's (or face's) coordinates. If I ever get perspective etc working, objects that are behind the screen SHOULD end up having a negative z value meaning I can just do logic "if z < 0 then don't render".
-
@Aidan-Oxley For each point, there are x, y and z coordinates. The player can draw an imaginary line from itself to all the points, the angle of the lines (x and y vectors) would output positions of dots on the screen. So if you are looking directly at a point, it should be it the center of the screen because x_vector and y_vector is 0, so there is no offset.
The player can rotate it's head, which offsets the angles. Currently, I'm using a circle which is surrounding the player. Notice that the circle goes 360°, all around the player. If a point is behind the player, it will still render. An 180° angle from the point to the player will still render the same as a 0° angle towards the player.
Yes, I tried making it disappear when it was behind the player. Though, the lines that it makes still renders because of the other points that aren't behind the player. 😬
-
I've took notes and did some illustrations. This may be too much to take at once, I apologize for that. 😬 -
@RobinsonX Ok, I have a little idea of what you're doing. So face's are fine right? I imagine you're making them work similarly to how I am (clearly slightly different though, somehow my skewed triangles don't end up with gaps making a square surface). You have faces not rendering when behind the player, but not lines? What if you have the lines hide themselves when a face they are associated with is hidden?
-
Also I think I can help with your original question if you give more details (unless it's already solved)
-
@Aidan-Oxley I'm waiting for the bitmap feature to come out so drawing faces won't be as much laggy. I tried doing the things you've mentioned and the results are weird, things disappear when you face slightly away from them.
-
I just realized, angles go from 0° to 360°. I can just use the angle themselves.. I can offset it by 180° and boom, there's that. 0° would be all the way left and 360° would be all the way right. And since it follows a path of a line, I don't have to worry about it rendering behind the player. 🤷♂️
-
Here's some more context:
IMG_1810.MP4