TheWhat603
(TheWhat603)
December 11, 2024, 5:38pm
#1
how would i get a point between 2 lines (and the lines themselves) like this terribly dramn image, i already how to get the midpoint by lerping the players cframe and the enemies cframe with a 0.5 alpha.
point i wna get is the black dot, the camera
2 Likes
0786ideal
(ideal)
December 11, 2024, 6:11pm
#2
You can use triangle solving math to get this corner, see that MidPoint → Player is hypotenuse, this mean that you can use trigonometry to find the final point
2 Likes
TheWhat603
(TheWhat603)
December 12, 2024, 6:20pm
#3
sorry, as I have the trig understanding of a 6yr old, I have no idea how to find coordinates in a triangle, can you provide a formula or method pls?
0786ideal
(ideal)
December 12, 2024, 6:36pm
#4
EgoMoose made tutorial about triangles, and he probably introduced triangle solving here:
# 2D Triangles
On occasion you may find it necessary to draw triangles given three points in 2D space. This article aims to go over one method that can be used to create those triangles using knowledge of trigonometry and the 2D rotation matrix.
## Table of Contents
* [Triangle decomposition](#triangle-decomposition)
* [Positioning the UI](#positioning-the-ui)
* [Positioning the UI Anchor points](#positioning-the-ui-anchor-points)
* [Optimization](#optimization)
## Triangle decomposition
The first thing we need to be aware of is that Roblox does not have a singular default shape that can be used to create any 2D triangle. However, using image labels we are able to upload right-angle triangles. Thus, we can decompose any triangle into a maximum of two right-angle triangles and draw from there. We can easily draw this process by placing a perpendicular line on the longest edge and having it intersect with the opposite vertex.

Now that we understand the basics of our goal we have to ask ourselves how we can achieve this mathematically. We'll start this process off by finding some information about the triangle depending on what side is the longest.

This file has been truncated. show original
I don’t really understand the image.
So the camera point is the intersection of the two lines, but how are the lines defined?
All I will say, if you have two lines using the vector equation for a line r = a + λb, you can find the intersection (if there is one) by equating them, then solving simultaneously for either scalar, then subbing that scalar back in to find the point.
TheWhat603
(TheWhat603)
December 13, 2024, 5:05pm
#6
js realised this is not where i want the camera to be
system
(system)
Closed
December 27, 2024, 5:06pm
#7
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.