Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a touched event for parts that are Anchored and CFramed?

Asked by 8 years ago

Touched events do not work for parts that are CFramed and anchored, as stated in the the wiki. This event does not fire if the part is being CFramed through something. (This is an excerpt from the wiki). My real problem is I have many parts flying around using BodyForces, and this creates a lot of physics lag. Unanchoring the 'bullet' makes the event fire, but glitches out the bullet itself. I have thought about using RenderStepped:wait()(something like that) so that each frame it isn't glitching out, but this would create the same amount of lag I had to start with. Is there any other way to have an event that acts just like a Touched event would?

--Here's part of the script.
lazer = script.Parent   
lazer.Touched:connect(function(otherPart)

end)
0
Updated my post with code and a link to the appropriate part on the Wiki User#6546 35 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

No, but there are solutions
You can check if it is intersecting with another part's physical boundaries after the CFrame. Use GetTouchingParts for this.

-- Following a CFrame operation
for k,v in pairs(movedPart:GetTouchingParts()) do
    -- v is now any part it touched, effectively.
end

I hope this helped. If you have any implementation issues, feel free to ask for help.

0
Thanks! I am still interested in your solution. For now, I am unanchoring the part and CFraming it every frame, which enables me to use the touched event. I plan on comparing each of the options I have to see which one runs with the least amount of lag. tkddude2 75 — 8y
0
YUSSSSSS thxxxxxx I did research for almost 3 hours and couldn't find that. THANK YOUUUUU NOW BACK TO SCRIPTING tkddude2 75 — 8y
0
I also have to add that you've only had one question, and you ended up answering it yourself. Lol tkddude2 75 — 8y
0
I'm good at answering things. I'm a solutions person. User#6546 35 — 8y
Ad

Answer this question