Part Orientation

Me and my friend are trying to make a move, we got all of it down except the parts that are supposed to be oriented as follows in the script. Example Screenshot:

How would i get around making it so such parts have an orientation as it shows? I tried using the CFrame of the HumanoidRootPart of the character, but when i try to use .Orientation to rotate the parts to the offset it gets messed up.

1 Like

I can’t really understand what you’re trying to accomplish, but is this what you want:
You want the parts to be oriented correctly but when you try to do it its messed up?

Yes, i want to have the parts be oriented like in the image, with a offset of 45 degrees per part. Eg: The first part will be oriented facing the front, the second part will be facing diagonally and such.

Ah. Easy solution.

Create 4 parts from the HumanoidRootPart position with the offset Vector3.new(0, -2.5, 0) and set the size to what appears in the image to be Vector3.new(20, 0.1, 1) and for each part, make the orientation 45 degrees more than the last. (starting from 0 of course)

I could supply a script for you if you dont understand.

That’s what I firstly did to try and solve the problem, but if you face another direction the orientation of these parts will change. That’s why I said they got messed up. And lastly yes, I would love to see a script regarding that solution!

for i = 1, 4 do
	local part = Instance.new("Part", workspace)
	part.Anchored = true
	part.Position = character.HumanoidRootPart.Position + Vector3.new(0, -2.5, 0)
	part.Orientation = character.HumanoidRootPart.Orientation + Vector3.new(0, i*45, 0)
	part.Size = Vector3.new(20, 0.1, 2)
end

Try that.

I think i figured out what I have to do regarding the facing other directions issue, should i do this?

part.Orientation = character.HumanoidRootPart.Orientation + Vector3.new(0, i*45, 0)`

Yes. If you want the ‘effect’ to be at an angle according to the HumanoidRootPart angle, yes.
I’ll edit my post accordingly.

Okay, I’ll try out the code and share the results!

From the image the parts seem to be arranged in a circle such that there are 8 “limbs” coming from the humanoid root part. To achieve this effect such we will be using some simple trig.

local yOffset = -2 --How far you want your parts to go down below the HMRP

function Part() -- Function to instantiate your part for each limb
 local prt =  Instance.new("Part",workspace)
 prt.Anchored = true
 prt.CanCollide = false
 return prt
end

local total = 8 -->> Such as there are 8 limbs in this post
local radius = 10

for i=1,total do
 local angle = (math.pi*2/total) * i  -- There are 360 degrees in a circle or pi*2 radians
 local x = radius * math.cos(angle) 
 local y = radius * math.sin(angle)
 
 local part = Part()
 part.CFrame = HMRP.CFrame * CFrame.new(x, yOffset, y)
 part.CFrame = CFrame.new(part.CFrame.p, HMRP.p)
end

Yes, that would work too.
However if he’s not going to do any sort of animating to it, he can just use the method I stated.

I was planning on making the “limbs” or “tentacles” extend to the front surface of that part, I will try out both to see which one works better with my idea, thanks guys!

Oh then use his method if you want each part to move its direction.
However if you want it to scale then use mine.

To achieve that you would have to manipulate the radius of the parts position. Not very difficult, good luck

What should I do about the “Unknown Global yOffset”?

I edited my previous post to include a variable for yOffset and change a few things, you can always change the yOffset and radius to whatever you desire

One question, does the Humanoid.HipHeight Exactly co-relate to the distance there is from the ground to the HumanoidRootPart?

Not entirely sure but you can try

Humanoid.HipHeight is the height from the ground to the HumanoidRootPart, yes.
If you’d like, use Humanoid.HipHeight instead for proper support for R6 and R15.

Using your code it just created a flurry of parts with no orientation…

image