I want to make a hitbox from region3
skill - https://gyazo.com/2edabfc940adaea4a873a6f584edbb1c
hitboxsize - https://gyazo.com/ad5903c410dd296dad167c2125d8315b
Is there any way to make region3 size = part size?
thx
I want to make a hitbox from region3
skill - https://gyazo.com/2edabfc940adaea4a873a6f584edbb1c
hitboxsize - https://gyazo.com/ad5903c410dd296dad167c2125d8315b
Is there any way to make region3 size = part size?
thx
Take the part position and subtract half of the part’s size for the first point. Then take the part position and add half of the part’s size for the second point. The part will of course need to have an Orientation of 0,0,0 because regions can’t be rotated.
local Hitbox= game.ReplicatedStorage.SkyPiecer.Hitbox:Clone()
Hitbox.Parent = game.Workspace
Hitbox.CFrame = plr.Character.HumanoidRootPart.CFrame * CFrame.new(0,50,-300)
Hitbox.Orientation = plr.Character.HumanoidRootPart.Orientation + Vector3.new(0,0,0)
local Size = Hitbox.Size
local region = Region3.new(Hitbox.Position - Size/2, Hitbox.Position + Size/2)
local part = Instance.new(“Part”)
part.Parent = game.Workspace
part.Size = region.Size
part.CFrame = region.CFrame
part.CanCollide = false
part.Anchored = true
how can i fix this? - https://gyazo.com/73072d1939c95f4dfcf24dc5095c894a
I’m not sure if this will be helpful to the issue you’re trying to fix (I’m not quite sure what problem needs to be fixed based on the Gyazo share in your last post), but have you considered the GetBoundingBox (roblox.com) method of Model class?
The problem is I want to create region3 that look like this
but it turns out like this
I’m sorry, I still don’t quite understand. Could you explain just in literal description the goal you’re trying to achieve? Including things like why you need to create a bounding box (and what you plan to do with it) and what event triggers this to take place.
I’m trying create a hitbox from region3 so my idea is create a part with this script
local Hitbox= game.ReplicatedStorage.SkyPiecer.Hitbox:Clone()
Hitbox.Parent = game.Workspace
Hitbox.CFrame = plr.Character.HumanoidRootPart.CFrame * CFrame.new(0,50,-300)
then create region3 from the part (same size and rotation) and player in region3 will takedamage
A potentially more effective and efficient way to create a “hitbox” would be to weld a Part to the character’s HumanoidRootPart. Then you can just use a raycast or loop through all existing hitboxes with a distance function to determine whether a collision has occurred. Does this help you out at all?
Use this module by @EgoMoose Rotated Region 3 Module
I also use it for my hitbox. You can do hitboxes easily based on parts too:
local RotatedRegion3 = require(game.ServerScriptService.RotatedRegion3)
local HitBox = Instance.new("Part")
-- define hitbox properties
local Region = RotatedRegion3.new(HitBox.CFrame, HitBox.Size)
local Parts = Region:FindPartsInRegion3(instance_to_ignore, parts_number)