|
| 06 Oct 2016 07:00 AM |
It is a coding effort to make any game playable for Xbox and one thing besides selecting GUI is being able to click using joysticks in roblox.
I could get around this using a 2D sprite moving on screen but i need it to get the 3D world position. It could also be done were you can move the mouse cursor via script instead and have it enabled via script on console to allow all the mouse functions but keep it an option for advanced users.
|
|
|
| Report Abuse |
|
|
Keruro
|
  |
| Joined: 23 Nov 2013 |
| Total Posts: 2327 |
|
| |
|
sonickyle
|
  |
| Joined: 01 Jan 2009 |
| Total Posts: 5653 |
|
| |
|
Borsy
|
  |
| Joined: 31 Jul 2014 |
| Total Posts: 15111 |
|
| |
|
|
| 06 Oct 2016 12:26 PM |
I would like help then if it is scriptable with in reason. Roblox has a world to screen space function so why not the other way around.
I know it is scriptable but to do it in lua it gets realy in efficent. |
|
|
| Report Abuse |
|
|
|
| 06 Oct 2016 12:27 PM |
They do have it the other way around. Here it is:
http://wiki.roblox.com/index.php?title=API:Class/Camera/ScreenPointToRay |
|
|
| Report Abuse |
|
|
|
| 06 Oct 2016 12:30 PM |
Thanks for this. I guess my google keywords wernt that good for finding this.
I still think it would be cool. Thank you for the help. |
|
|
| Report Abuse |
|
|
| |
|
Borsy
|
  |
| Joined: 31 Jul 2014 |
| Total Posts: 15111 |
|
|
| 06 Oct 2016 12:43 PM |
local function ScreenToWorld(screenPoint, screenSize, pushDepth) local cameraFOV, cameraCFrame = Camera.FieldOfView, Camera.CoordinateFrame local imagePlaneDepth = screenSize.y / (2 * math.tan(math.rad(cameraFOV) / 2)) local direction = Vector3.new(screenPoint.x - (screenSize.x / 2), (screenSize.y / 2) - screenPoint.y, -imagePlaneDepth) local worldDirection = (cameraCFrame:vectorToWorldSpace(direction)).Unit local theta = math.acos(math.min(1, worldDirection:Dot(cameraCFrame.lookVector))) local fixedPushDepth = pushDepth / math.sin((math.pi / 2) - theta) return cameraCFrame.p + worldDirection * fixedPushDepth end
from PopperCam
|
|
|
| Report Abuse |
|
|