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: Checking if Frame is covering an object

Previous Thread :: Next Thread 
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
22 Feb 2017 04:50 PM
Sounds a little weird but im programming an icon that should only appear if its got a part behind it. By this i mean, the frame is fixed on the screen and if the player moves their camera to where the 3D part is behind the 2D Frame, this is detected.

It is abstract and yes im probably overthinking it, but if you have any ideas please let me know, Just about to finish these tedious little task
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
22 Feb 2017 04:54 PM
I normally complain about on replies but this is pretty complex so no hard feelings this time around
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
22 Feb 2017 05:03 PM
I said that hoping someone would reply in spite of my shortcomings but im clearly mistaken xD this is the roblox forum what am i thinking
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
23 Feb 2017 01:21 PM
Really?
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
23 Feb 2017 01:34 PM
Some forum this is
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
23 Feb 2017 01:54 PM
##########################################################################
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
23 Feb 2017 01:55 PM
Go to the Camera page on the wiki.

Scroll down to WorldToScreenPoint.
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
23 Feb 2017 02:34 PM
Thats not what I want tho. Ive used it earlier in my code and after getting an understanding of what it does its not suitable for this task.

The worldtoscreenpoint is very useful as it detects when the brick is on screen allowing me to make my icon visible and not visible with respect to that

However when the object is on screen but near the edge of the screen. The frame fixed about the centre is still visible.

In essence i want to be able to see if object is still behind the frame itself and if not the icon be invisible
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
23 Feb 2017 02:48 PM
https://www.roblox.com/games/564459714/Test1

You can drag the frame around.

Get it over the red cube.
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
23 Feb 2017 03:30 PM
Looks really indepth but ill give it my best shot at dissecting whats going on. Thanks mate
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
25 Feb 2017 08:41 AM
Chimmhc i get what all of it does except

local function Within(x1, y1, w1, h1, x2, y2)
return x1 <= x2 and x1 + w1 > x2 and
y1 <= y2 and y1 + h1 > y2
end

its not used anywhere else within the script nor does the function seem to be fired. Whats its use?
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
25 Feb 2017 09:26 AM
Chimmihc if you feel ive overused the help you've given I completely understand and thank you for what you've done.

If however you're willing to help one last time here goes

Pause = 0.05
Change = true

Cam.Changed:connect(function(y))
if Change == true then
Change = false

if so and so then
--Camera script here (Works fine thank you chimmihc)
else return end
wait(Pause)
Change == true
end)

Works the first time you stay within the bricks cooridinates. Look away then look back and it no longer registers whats going on and the frame no longer appears. I am so bloody close to finishing this thanks to you chimmihc. Even if you're tired of me just know i think you're a bloody legend.
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
25 Feb 2017 09:28 AM
and if its not true I have an "else return end" line just before the wait(Pause)
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
25 Feb 2017 01:53 PM
Well, from what I can see the problem would be "else return end".

Because of the Change variable condition.
That else causes it to return before setting Change to true again, and it will never get passed the "if Change == true then" part after that.
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
27 Feb 2017 02:30 PM
Chimmihc after applying all this ive tried using Raycasting to polish the script and not make the icon appear at weird times. Im shooting the raycast from the players head to a point "x" which is defined as

local x, screen = cam:WorldToScreenPoint(Part.Position)

and the line producing the raycast's direction is

local ray = Ray.new(Player.Character.Head.CFrame.p, (x - Player.Character.Head.CFrame.p).unit * 100)


however this just projects the ray towards a fixed point in space and i have no clue why.
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
27 Feb 2017 03:46 PM
I print X and with camera movement, the outputted value changes but for some reason the raycast is still pointing to the same fixed point in the sky.
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
27 Feb 2017 05:42 PM
What is it you are trying to do?

Get it to show up when any of the part is behind the icon rather than just the center?
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
28 Feb 2017 03:01 PM
Exactly.
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
28 Feb 2017 08:16 PM
Check the place now. I updated it to check the corners of the part as well and I added a point showing where the collision is detected.
It works fine unless the part appears smaller than the GUI object.

Also, do you care if there are objects between the part and the screen?
If so I'll go about it another way.
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
28 Feb 2017 08:17 PM
bigger*

Not smaller.
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
01 Mar 2017 01:56 PM
chimmihc do you reckon what i have in mind is far fetched?
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
01 Mar 2017 01:57 PM
I made a version where you can click F to enter grappling mode where your button turns to a grappling icon that you then click to grapple. Do you reckon I should go through this or stick with the help you're giving me
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
01 Mar 2017 05:09 PM
What is the effect you are trying to create?
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
01 Mar 2017 05:32 PM
Hes trying to make that dumb grappling thing for batman


Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
02 Mar 2017 12:43 PM
A better grapnel gun than the current one for my Batman-Centric game. Im not a total noob and have already made a glide extremely similar to the one from the arkham games but this grapnel gun is presenting new issues i didnt expect and thats why im asking help for it
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