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: Finding if a part is under a part

Previous Thread :: Next Thread 
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
07 Jan 2015 10:06 PM
each part is the same size,(1,1,1), and they are on a grid and all of them are uniform in order like chess board squares without holes

This is my loop that is suppose to check if a part is inside a part(WHICH WORKS), and the second part which is suppose to check if there is a part directly below the part(WHICH DOESNT WORK)


-- Pos is the parts position, parts is the table of parts,
-- if good is true at the end, its suppose to keep it where it is, it good is false, its suppose to get another position


for _,v in pairs(parts)do
if pos.p==v.CFrame.p then -- Check if the part is inside one
good=false
break
elseif not pos.Y==S.Y then
if pos.p+Vector3.new(0,-S.Y,0)==v.CFrame.p then - check below (broke)
good=true
break
else
good=false
end
end
end
Report Abuse
A2D8 is not online. A2D8
Joined: 15 Jun 2014
Total Posts: 548
08 Jan 2015 12:18 AM
You can't compare two floating point values to each other, sorry. See this section of the wiki for some more info:

http://wiki.roblox.com/index.php/Vector3#Methods
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
08 Jan 2015 12:29 AM
'You can't compare two floating point values to each other, sorry. See this section of the wiki for some more info:'
Stop giving incorrect information.

Vector3s are not floats.

OP, compare by the distance between the 2 vectors.
Report Abuse
A2D8 is not online. A2D8
Joined: 15 Jun 2014
Total Posts: 548
08 Jan 2015 01:27 AM
Uh, okay? They most certainly are. What do you think they are?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
08 Jan 2015 01:31 AM
No, Vector3s are just a type of data structure.
Floats are just a way to represent a number with a fractal part.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
08 Jan 2015 01:32 AM
Look I'm comparing 2 floats:

print(0.5 < 0.7)
Report Abuse
A2D8 is not online. A2D8
Joined: 15 Jun 2014
Total Posts: 548
08 Jan 2015 01:33 AM
You are so pedantic that it hurts. You're trying way too hard to prove yourself.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
08 Jan 2015 01:52 AM
I'm not trying to prove myself, I'm just telling you that you're wrong so you don't give false information like this to others. I'm trying to help people by helping you so you don't misguide, if you can't take criticism then get out.
Report Abuse
A2D8 is not online. A2D8
Joined: 15 Jun 2014
Total Posts: 548
08 Jan 2015 02:01 AM
You're the one that can't take criticism. You should take your own advice. You haven't contributed anything to this discussion at all, you just repeated what I already said and then incorrectly announced that I'm spreading misinformation.

There is such a thing as intentional simplification. The original poster of this thread probably doesn't care that a Vector3 is a separate datatype from a float. Anyone with any sort of brain can make the logical connection that "a Vector3 is floats" probably means that a Vector3 _contains_ 3 floats. By pointing that distinction out, you're only showing that you care more about making yourself sound intelligent rather than actually helping.

It's fine to want to make yourself sound smart, but don't be so inflammatory about it. It has the opposite effect of what you're aiming for and you're just making the situation fuzzier.

You're also being way too pedantic about the meaning of "comparison." Of course you can use less than or greater than, how stupid could you possibly be to not make that connection from reading the wiki article I linked? It was more than obvious that by comparison I meant the == operator. You most definitely can't rely on that operator to give you the expected results when dealing with any sort of position from ROBLOX's API. If you don't understand why, I suggest you google it and read up on error accumulation.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
08 Jan 2015 02:03 AM
A paragraph? Huh, seems like you're too angry.
I'll just not read it all and leave since I see a lot of ignorant assumptions.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
08 Jan 2015 02:05 AM
local function clipsBelow(part)
local o = part.CFrame;
part.Position = o*Vector3.new(0,-part.Size.Y,0);
local n = (o*Vector3.new(0,-part.Size.Y,0)).p~=part.Position;
part.CFrame = o;
return n;
end
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
08 Jan 2015 02:05 AM
"Vector3 is 3 floats"
.... wow


learn what a float value is pal
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
08 Jan 2015 04:12 PM
@elun

I've tried your other function and how I used it didnt work at all and it doesnt even look like it would be to check if a part is below or on one (based on what I saw),

I came up with this, and I was wrong on the first part (IT DOES NOT CHECK IF IT IS INSIDE IT)

It only checks if the part is beow it (which works fine), it does not work for checking if a part is inside another part.


for _,v in pairs(parts)do
if (pos.p-v.CFrame.p).Magnitude<.1 then
good=false
break
elseif pos.Y~=lowLevel.Y then
if (pos.p-Vector3.new(0,1,0)-v.CFrame.p).Magnitude<.1 then
good=true
break
else
good=false
end
end
end
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
08 Jan 2015 04:25 PM
Mine checks if a part is within its height below it.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
08 Jan 2015 04:27 PM
local function clipsBelow(part)
local o = part.CFrame;
part.Position = (o*Vector3.new(0,-part.Size.Y,0)).p;
local n = (o*Vector3.new(0,-part.Size.Y,0)).p~=part.Position;
part.CFrame = o;
return n;
end


That should be less prone to errors, since I actually supplied position with a V3 instead of a CFrame
I'm pretty sure *-Y is local down .-.
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
08 Jan 2015 04:41 PM
I still don't see how that is suppose to do anything
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
08 Jan 2015 04:41 PM
Also now im trying to find out of the part is inside it
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
09 Jan 2015 01:58 AM
I gave you one for if it's clipping.
Report Abuse
A2D8 is not online. A2D8
Joined: 15 Jun 2014
Total Posts: 548
09 Jan 2015 02:27 AM
I do not have within me the amount of stupid necessary to see your point of view here, cntkillme.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
09 Jan 2015 02:46 AM
And here I thought my English was bad. I don't think you realize that continuing to argue with me is pointless since your responses are dumb and your knowledge of how Lua, no, programming in general, works, seems to be very awful.

One, 'you just repeated what I already said and then incorrectly announced that I'm spreading misinformation.' is incorrect. You should read the replies carefully, as I was completely disagreeing with you.

Two, '"a Vector3 is floats" probably means that a Vector3 _contains_ 3 floats' is just stupid. The word "is" is not a synonym for "contains". In fact, they are so different that I can, with confidence, say you have no idea what floats are.

Three, 'The original poster of this thread probably doesn't care that a Vector3 is a separate datatype from a float.' that is not an excuse to spread misinformation. Just because he might not care it doesn't make it right to say it's something when it's obviously not.

Four, 'It's fine to want to make yourself sound smart, but don't be so inflammatory about it. It has the opposite effect of what you're aiming for and you're just making the situation fuzzier.' I am not making myself sound smart, you're making yourself look stupid.

And finally, 'Of course you can use less than or greater than, how stupid could you possibly be to not make that connection from reading the wiki article I linked? It was more than obvious that by comparison I meant the == operator.' greater than and less than are comparison operators, if you knew anything about algebra you would know this.
Report Abuse
A2D8 is not online. A2D8
Joined: 15 Jun 2014
Total Posts: 548
09 Jan 2015 02:51 AM
This is hilarious. How autistic are you?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
09 Jan 2015 02:54 AM
Proves my point even further, get out already.
Report Abuse
A2D8 is not online. A2D8
Joined: 15 Jun 2014
Total Posts: 548
09 Jan 2015 03:03 AM
It was a serious question. I don't know how you could possibly function in regular society as you are.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
09 Jan 2015 03:06 AM
Heh. You finally realized you're wrong and now you are resorting to insulting. How common, this isn't the first and definitely won't be the last.
Report Abuse
A2D8 is not online. A2D8
Joined: 15 Jun 2014
Total Posts: 548
09 Jan 2015 03:10 AM
Except I just explicitly said it's not an insult. But that's okay, you're obviously experiencing a different reality than the rest of us.

I mean, honestly, you're trying to tell an actual engineer that he doesn't know what a float is. Do you even realize how ridiculous your whole argument is? I'm amazed at how full of yourself you are, but I suppose you'll (hopefully) grow out of it eventually.

I'm not sure you actually know what you're talking about. I could ask you if you know what a float even is, but I'm sure you'd just regurgitate Wikipedia at me. People like you are so predictable. You're not the first, and you won't be the last.
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