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: Question - Camera

Previous Thread :: Next Thread 
alij12 is not online. alij12
Joined: 03 Oct 2011
Total Posts: 1204
20 Aug 2016 07:47 PM
Is it possible to know if a player can see something? As in, its within view of their camera?
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
20 Aug 2016 07:48 PM
you can use region3 from the cameras min ScreenPoint to the max ScreenPoint by using the function in the camera at 0,0 pixels and at the viewport size
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
20 Aug 2016 07:49 PM
and multiplying by lookvector.

OR,

you can check if the camera is facing something by seeing how far the direction is off from the center of the screen
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
20 Aug 2016 07:50 PM
those are dumb ways.

http://wiki.roblox.com/index.php?title=API:Class/Camera/WorldToScreenPoint
returns a boolean if the obj is visible in camera


Report Abuse
2eggnog is not online. 2eggnog
Joined: 08 Nov 2008
Total Posts: 1351
20 Aug 2016 07:51 PM
Two ways to check.

1. Use Camera.WorldToScreenPoint(object.Position). If it's a value located on the screen, then they can see it.

2. Obtain a unit vector at the position of the camera pointing towards the object. Take the dot product of that vector and the camera's lookVector. Take the inverse cosine of the result to obtain the angle between the two vectors, and check if that's less than the camera's field of view.

Pretty sure #2 would be more efficient, despite the explanation being longer.


Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
20 Aug 2016 07:52 PM
oh ok i didnt know about the second argument worldtoscreen returns lol oops
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