databrain
|
  |
| Joined: 01 Jan 2013 |
| Total Posts: 3342 |
|
|
| 24 Jan 2013 08:55 PM |
So, I was building in my game, a script that combines two Electrons When they touch. They are small though. My script detects big objects however, it doesn't detect my small electrons.
My electrons are Anchored, and are moved by a script using CFrame. I'm wondering if CFrame stops it from detecting the onTouch.
|
|
|
| Report Abuse |
|
|
|
| 24 Jan 2013 09:19 PM |
| CFrame and onTouch don't mix well. :/ |
|
|
| Report Abuse |
|
|
databrain
|
  |
| Joined: 01 Jan 2013 |
| Total Posts: 3342 |
|
|
| 24 Jan 2013 09:22 PM |
How should I do this then?
|
|
|
| Report Abuse |
|
|
|
| 24 Jan 2013 09:24 PM |
That's a good question. I have not tried to find the answer yet. I wish I could help you. :/ |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 24 Jan 2013 09:27 PM |
"CFrame and onTouch don't mix well"
What? You're comparing a property to an event. Touched event activates when a part touches whatever is connected.
Just use a Touched event. CFrame won't affect it unless you pass the part without it being touched |
|
|
| Report Abuse |
|
|
databrain
|
  |
| Joined: 01 Jan 2013 |
| Total Posts: 3342 |
|
|
| 24 Jan 2013 09:27 PM |
Well this is a pickle. I could use a while loop, to detect if it's really close to another electron. But while loops are kind of laggy. The reason Why I want them to collide is because of lag. It reduces the number of electrons. So I think a while loop would be counter productive. |
|
|
| Report Abuse |
|
|
databrain
|
  |
| Joined: 01 Jan 2013 |
| Total Posts: 3342 |
|
|
| 24 Jan 2013 09:29 PM |
@miz the Touched event won't detect other electrons, but will detect anything else. I think It has to do with the fact that their being moved by CFrame. |
|
|
| Report Abuse |
|
|
|
| 24 Jan 2013 09:32 PM |
@miz, when a part is being constantly moved through CFrame, onTouch doesn't detect that part. :/ Any solutions? |
|
|
| Report Abuse |
|
|
|
| 24 Jan 2013 09:35 PM |
| Never actually used this before, but Region3 may work. http://wiki.roblox.com/index.php/IsRegion3Empty_%28Method%29 |
|
|
| Report Abuse |
|
|
|
| 24 Jan 2013 09:41 PM |
Hmmmm, this is strange.
I set a part to constantly move and set any part it touches to the color red.
It set my character's parts to red, but not the base. What could this mean? |
|
|
| Report Abuse |
|
|
databrain
|
  |
| Joined: 01 Jan 2013 |
| Total Posts: 3342 |
|
|
| 24 Jan 2013 09:43 PM |
But would using a while loop aside with region3 lag more than just having no collision? There are going to be a bunch of electrons. If I used a while loop, I don't know if it will lag a lot or not. |
|
|
| Report Abuse |
|
|
|
| 25 Jan 2013 02:09 AM |
| Why do you not just attempt using magnitude? |
|
|
| Report Abuse |
|
|
shred1894
|
  |
| Joined: 30 Aug 2009 |
| Total Posts: 6515 |
|
|
| 25 Jan 2013 02:33 AM |
Try using magnitude and tables.
It feels a tad hacky to do it that way, but it works.
S-1894>(Supreme_Commander_of_Advanced_Zero) |
|
|
| Report Abuse |
|
|
databrain
|
  |
| Joined: 01 Jan 2013 |
| Total Posts: 3342 |
|
|
| 26 Jan 2013 10:55 PM |
I use magnitude to move the darn things. What to you mean by "use magnitude"? |
|
|
| Report Abuse |
|
|
|
| 27 Jan 2013 04:58 PM |
if (part1.Position - part2.Position).magnitude <= 0 then print("touching") end |
|
|
| Report Abuse |
|
|
databrain
|
  |
| Joined: 01 Jan 2013 |
| Total Posts: 3342 |
|
|
| 27 Jan 2013 05:26 PM |
| already did that. it works. |
|
|
| Report Abuse |
|
|