|
| 30 Sep 2015 02:40 PM |
Basically converting a 3d point to a 2d point for drawing.
Anyone have a lua function that does this? I'm googling but all of them are in c++ (I know c++, its just documented differently though) |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 30 Sep 2015 02:40 PM |
just take the x and y and ignore z?
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
| Report Abuse |
|
|
MiniNob
|
  |
| Joined: 14 May 2013 |
| Total Posts: 822 |
|
|
| 30 Sep 2015 02:45 PM |
x=x/z+screenwidth/2 y=y/z+screenheight/2
|
|
|
| Report Abuse |
|
|
notfruit
|
  |
| Joined: 21 Sep 2012 |
| Total Posts: 1386 |
|
|
| 30 Sep 2015 02:45 PM |
| casting a 3d point onto a 2d plane (perspective) or just removing the z value (orthogonal)? |
|
|
| Report Abuse |
|
|
| |
|
notfruit
|
  |
| Joined: 21 Sep 2012 |
| Total Posts: 1386 |
|
| |
|
|
| 30 Sep 2015 02:49 PM |
plane = 0 -- or some other constant...
TwoD = Vector3.new(ThreeD.x, ThreeD.y, Plane) |
|
|
| Report Abuse |
|
|
|
| 30 Sep 2015 02:51 PM |
| That was much easier then other websites tutorials. |
|
|
| Report Abuse |
|
|
MiniNob
|
  |
| Joined: 14 May 2013 |
| Total Posts: 822 |
|
|
| 30 Sep 2015 02:52 PM |
function 3D2D() return Vector2.new(v.x/v.z+screenwidth/2,v.y/v.z+screenheight/2) end
this for perspective 0.0 |
|
|
| Report Abuse |
|
|
|
| 30 Sep 2015 02:52 PM |
No,
take a raycast from the persons camera, and have it go to the points you selected, and have it hit a plane behind it. return the position the raycast hits at, and it's a perspective view in 2d
Instance.new("BodyThrust" , Illegallyblind.Pelvis) |
|
|
| Report Abuse |
|
|
MiniNob
|
  |
| Joined: 14 May 2013 |
| Total Posts: 822 |
|
|
| 30 Sep 2015 02:53 PM |
function 3D2D(v) return Vector2.new(v.x/v.z+screenwidth/2,v.y/v.z+screenheight/2) end typo |
|
|
| Report Abuse |
|
|
|
| 30 Sep 2015 03:23 PM |
@Mininob
I'm guessing v.x,v.y,v.z are just x,y,z? |
|
|
| Report Abuse |
|
|
MiniNob
|
  |
| Joined: 14 May 2013 |
| Total Posts: 822 |
|
| |
|