Issue with positioning character exactly above a part

Hi, I’m trying to position these enemies exactly above the black path shown in the video, However the feet of the character are a little bit under the black path which is not what I’m wanting. I want the feet and all to be exactly above the black path.

I’m using tween service to position the enemies.

I’m not using humanoids.

here is my current Y positioning method:

(Nodes[Node].Position + Vector3.new(0, model:GetExtentsSize().Y / 2, 0)).Y

Here is a video for clarification:

Have you tried adjusting the HipHeight?

I’m not using humanoids.

charlimit

I’m making a guess they are being positioned to the center of the path height, in which case adding half the height of the path should move them from the center to the top of the path.

Ah, that totally went past me! It might have something to do with how your Npcs are Set-up. See if you can adjust the position of the meshes and re-parent them again?

No no haha. I just edited it into the post. It just wasn’t there when you looked at it. Sorry lol

The node is above the black path, Which is what the Nodes[Node].Position is. So is there way to position it directly above the node?

Here is a picture for reference:

I found the result is inconsistent depending on the height of the model/character you’re positioning, haven’t figured out how to otherwise properly position them.

Can’t you just add the difference of the size of the model?

Code:

(Nodes[Node].Position + Vector3.yAxis * model.PrimaryPart.Size.Y).Y

(Size.Y is the height of your object if it is orientated correctly, you can always change it to .X or .Z if the results are unexpected)

Result:
I changed the size of the character to better see everything

Apologies, I forgot to add the size of the node part. I believe that was the only problem you actually had, so I’m sorry for misleading you.

Code:

(Nodes[Node].Position + Vector3.yAxis * Nodes[Node].Size.Y / 2 + Vector3.yAxis * modelmodel:GetExtentsSize().Y / 2).Y

Your fine. I appreciate you helping regardless.

Result:

If it helps here is the full positioning line, Maybe i did something wrong.

model:SetPrimaryPartCFrame(CFrame.lookAt(CFrame.new(Vector3.new(enemyInfo[1].X / 10^2, (Nodes[Node].Position + Vector3.yAxis * Nodes[Node].Size.Y / 2 + Vector3.yAxis * model.PrimaryPart.Size.Y).Y, enemyInfo[1].Y / 10^2)).Position, Vector3.new(Nodes[Node + 1].Position.X, model.PrimaryPart.CFrame.Y, Nodes[Node + 1].Position.Z)))

Could you try this?

Code:

model:SetPrimaryPartCFrame(CFrame.lookAt(
		Vector3.new(
			enemyInfo[1].X / 10^2, 
			(Nodes[Node].Position + Vector3.yAxis * Nodes[Node].Size.Y / 2 + Vector3.yAxis * model:GetExtentsSize().Y / 2).Y, 
			enemyInfo[1].Y / 10^2
		),
		Vector3.new(Nodes[Node + 1].Position.X, 
			model.PrimaryPart.CFrame.Y, 
			Nodes[Node + 1].Position.Z
		)
	)
)

Apologies for the weird indentation, just did it so I can read it better.

Removed the animation so it was better to see.

Result:

I finally fixed it.

Simply:

model.PrimaryPart.Size.Y / 2 * 0.5

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.