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: actively checking for contact with a brick?

Previous Thread :: Next Thread 
PandaDemic is not online. PandaDemic
Joined: 21 Jan 2011
Total Posts: 13422
12 Mar 2017 09:59 PM
i dont like the terrain underwater, but i want to make an underwater game. however, being above surface is part of it as well. and the way i've decided to handle the underwater 'effect' is a ColorCorrection module within lighting to be disabled and enabled on cue with the player being in or out of the water.

i thought of 2 ways to do this...
1. the entire underwater is a non-collideable invisible brick. when you're in it, colorcorrection is enabled. when you aren't, it's disabled.
2. there is a thin invisible non-collideable brick at surface level. when the player touches it, it waits for just a tiny bit to determine where the player's torso is in respect to itself. if player is below, enable colorcorrection. if above, disable.

which would be better?


are you not ENTERTAINED!??!
Report Abuse
PandaDemic is not online. PandaDemic
Joined: 21 Jan 2011
Total Posts: 13422
12 Mar 2017 10:02 PM
i also ask this because of swimming mechanics. im essentially just going to modify a basic fly script and have it apply to the player underwater, and become disabled while over it. i just think that it might be smarter to establish something simpler (such as the underwater colorcorrection) beforehand.


are you not ENTERTAINED!??!
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
12 Mar 2017 10:02 PM
game:getService( "RunService" ).Heartbeat:connect(function() local ray = Ray.new( camera.CFrame.p, Vector3.new(0,1,0)) local ## ##### mat = workspace:FindPartOnRay( ray, character ) if mat.Name == "Water" then --submerged else --not end end)
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
12 Mar 2017 10:03 PM
game:getService( "RunService" ).Heartbeat:connect( function()
local ray = Ray.new( camera.CFrame.p, Vector3.new(0, 1, 0) )
local _ , _ , _ , mat = workspace:FindPartOnRay( ray, character )
if mat.Name == "Water" then
--submerged
else
--not
end
end )
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
12 Mar 2017 10:03 PM
Would this be sufficient?

http://wiki.roblox.com/index.php?title=API:Class/Humanoid/StateChanged


Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
12 Mar 2017 10:04 PM
yea but that would make it appear when the character is under water not when the camera is

unless it is 2d then that would work
Report Abuse
PandaDemic is not online. PandaDemic
Joined: 21 Jan 2011
Total Posts: 13422
12 Mar 2017 10:05 PM
hm.. thank you for both answers! i will consider the use of both. although, wunder, i hope this isn't annoying, but what exactly does that script do? I haven't worked with rays yet. im still a little nooby


are you not ENTERTAINED!??!
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
12 Mar 2017 10:05 PM
it casts a tiny ray from the camera to see if it is submerged and if it is then the material would be water
Report Abuse
PandaDemic is not online. PandaDemic
Joined: 21 Jan 2011
Total Posts: 13422
12 Mar 2017 10:06 PM
so the player's camera itself can be called ## a game object? well color me impressed i never knew! are you not ENTERTAINED!??!
Report Abuse
PandaDemic is not online. PandaDemic
Joined: 21 Jan 2011
Total Posts: 13422
12 Mar 2017 10:07 PM
well jeez thanks filters.
*the player's camera itself can be called AS a game object?


are you not ENTERTAINED!??!
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
12 Mar 2017 10:08 PM
if you want it to detect a certain part (that would need to be invisible and the camera would go inside it) then you need to detect with hit instead of ## ##### mat and then you can check if the hit object is the 'water' with whatever else you want
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
12 Mar 2017 10:09 PM
if you want it to detect a certain part (that would need to be invisible and the camera would go inside it) then you need to detect with hit instead of _ , _ , _ , mat

and then you can check if the hit object is the 'water' with whatever else you want

also the players camera is an object, it is a camera object and when used locally belongs to the workspace (isnt necesarilly a child)
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
12 Mar 2017 10:11 PM
OP, is the game first person?


Report Abuse
PandaDemic is not online. PandaDemic
Joined: 21 Jan 2011
Total Posts: 13422
12 Mar 2017 10:11 PM
huh! never knew that
thanks for the info and help!


are you not ENTERTAINED!??!
Report Abuse
PandaDemic is not online. PandaDemic
Joined: 21 Jan 2011
Total Posts: 13422
12 Mar 2017 10:12 PM
ideally fixed distance 3rd person.
the only case in which it would zoom out is a pre-scripted event


are you not ENTERTAINED!??!
Report Abuse
PandaDemic is not online. PandaDemic
Joined: 21 Jan 2011
Total Posts: 13422
12 Mar 2017 10:13 PM
for reference, if you've ever heard of Abzu, that is what i'm basing it off of


are you not ENTERTAINED!??!
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
12 Mar 2017 10:13 PM
Alright, then raycasting is most likely the most plausible solution for you. Good luck.


Report Abuse
PandaDemic is not online. PandaDemic
Joined: 21 Jan 2011
Total Posts: 13422
12 Mar 2017 10:14 PM
thanks! i think maybe i will mess around with rays first, and get a little more comfortable with how they behave and how they can be applied.

again, thanks for the help!


are you not ENTERTAINED!??!
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
12 Mar 2017 10:19 PM
http://wiki.roblox.com/index.php?title=Ray
http://wiki.roblox.com/index.php?title=Raycasting
http://wiki.roblox.com/index.php?title=Raycasting_Basics
http://wiki.roblox.com/index.php?title=Making_a_ray-casting_laser_gun
http://wiki.roblox.com/index.php?title=Dot_product
http://wiki.roblox.com/index.php?title=Cross_product

try looking at these sources, it may seem like a lot, but it is helpful
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
12 Mar 2017 10:20 PM
it should be in order from simplest to most difficult in terms of understanding
Report Abuse
SnowyKirby is online. SnowyKirby
Joined: 15 Jan 2013
Total Posts: 68009
12 Mar 2017 10:22 PM
imma check those out tomorrow lol
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