generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: See if a brick is on player's screen

Previous Thread :: Next Thread 
Grandmaster_Askav is not online. Grandmaster_Askav
Joined: 06 Aug 2016
Total Posts: 662
11 Oct 2016 12:04 AM
The Method I have been using works through walls so yea.


Report Abuse
anaIyze is not online. anaIyze
Joined: 29 May 2014
Total Posts: 2048
11 Oct 2016 12:38 AM
ok?
Report Abuse
Grandmaster_Askav is not online. Grandmaster_Askav
Joined: 06 Aug 2016
Total Posts: 662
11 Oct 2016 12:44 AM
Maybe I am not clear. How do I find out whether a part or brick is on the player's screen.


Report Abuse
anaIyze is not online. anaIyze
Joined: 29 May 2014
Total Posts: 2048
11 Oct 2016 12:51 AM
what I would do is make a script that clones all parts that are seen by them on their playerGui onto a "screen" (ScreenGui) & continuously update it so it follows the exact same position as it does on the playerGui (use runService)
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
11 Oct 2016 01:02 AM
you can use the camera's WorldToViewportPoint method to see if a Vector3 position is being rendered in the bounds of the player's camera. make sure to check every corner of the brick so that it will count as visible even if only a little bit of it is on the screen. then to make sure it's not obstructed by any walls, use raycasting.

http://wiki.roblox.com/index.php?title=API:Class/Camera/WorldToViewportPoint
http://wiki.roblox.com/index.php?title=Raycasting


Report Abuse
Grandmaster_Askav is not online. Grandmaster_Askav
Joined: 06 Aug 2016
Total Posts: 662
11 Oct 2016 01:20 AM
How would I use Raycasting to do this?


Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
11 Oct 2016 07:56 PM
cast a ray from your camera to each corner of the brick. if all the rays collide with something before they hit the brick, then the view of the brick is clearly obstructed


Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
11 Oct 2016 08:10 PM
raycast + field of vision + Lookvector


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image