|
| 15 Jul 2015 02:21 AM |
| Let's say I have two anchored parts, one is already placed. The other one is being placed by a player holding a tool. How would I check if this second part is through the first part? How do I know there is collision between those two parts? I doubt the Touched event works on this, because you don't actually use physics... |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 15 Jul 2015 02:25 AM |
You might be able to use magnitude for this.
"Talk is cheap. Show me the code." - Linus Torvalds |
|
|
| Report Abuse |
|
|
|
| 15 Jul 2015 02:25 AM |
An inefficient way would to be :
function touch(hit) if hit.Name = "Part1Name" then print("I'm touching the first part.") end end
script.Parent.Touched:connect(hit)
I'm not a very well scripter, still learning, so sorry dude.
"YOU SHALL NOT BLOX!" // Scripter // Developer // ~ Join my primary! |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 15 Jul 2015 02:35 AM |
magnitude[2]
just test out how much "distance" needs to be between the 2 parts for them to be touching or nearly touching
mouse.Move:connect(function() if (partBeingPlaced.Position - part2.Position).magnitude <= 1 then print("touching..?") end end) |
|
|
| Report Abuse |
|
|
|
| 15 Jul 2015 02:44 AM |
| Yes, but isn't that a bit hard and inefficient? Because what if the part isn't a cube? Then the x size can be 2 and z size can be 3, magnitude would vary from where the part is oriented relatively to the other part... |
|
|
| Report Abuse |
|
|