An Event fired when your part instance is collided with something
for beginers :DD
How Does This Work?
- Raycasting on AssemblyVelocity rather than “.Touched” event or Overlamp Hitboxes
- Using “FastSignal”, we able to define our own RbxSignal
- Light weight
local rs = game:GetService('ReplicatedStorage')
local pd = require(rs.Packages.PhysicCollider)
local plr =game.Players.LocalPlayer
local char = plr.Character
local root:Part = char:WaitForChild('HumanoidRootPart')
local params = RaycastParams.new()
params.FilterDescendantsInstances = {char}
local newPd = pd.New(root,3,params)
newPd.OnCollide:Connect(function(Collide:pd.Collide)
print(`Collided with {Collide.Hit} at {Collide.Position}`)
end)
What can it do for you?
- Returning the
Part/3dthat the object is collided with - Returning the
Positionof where your object is collided - Returning the
Force Directionof your object before it collided
You can easily make cool stuff with it and enjoy your faster progress
Example Bouncy Player :
local BounceAmount = 0
local Colliding:RBXScriptSignal
Colliding = newPd.OnCollide:Connect(function(Collide:pd.Collide)
print('bounce')
BounceAmount += 1
local originalVector = Collide.Force
local mirroredVector = Vector3.new(originalVector.X, -originalVector.Y, originalVector.Z)
local bv = Instance.new('BodyVelocity', root)
bv.MaxForce = Vector3.new(0,10000,0)
bv.Velocity = mirroredVector/3
game.Debris:AddItem(bv, .2)
if BounceAmount == 3 then
print("destroy")
bv:Destroy()
Colliding:Disconnect()
end
end)