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

Placement System goes inside parts?

Asked by 3 years ago
Edited 3 years ago
Mouse.Move:Connect(function()
    Part.Position = Mouse.Hit.Position

end)

I hope you get a idea of what I am doing

The part just goes inside of whatever position it is

like if I have a part thats 4 by 4 by 4 I need to half it and add a vector3 value to make it go above the part

Like for example if I have a baseplate and I move my mouse to Position the part to my Mouse the thing goes inside the baseplate, atleast half of it always goes inside the baseplate

I want it completely above the baseplate not inside it any bit.

And I did manage to somehow solve the problem just a bit and that was by getting the half size of the part and adding it as a vector3 to position it.

It looks like this

if Mouse.TargetSurface.Name == "Top" then
        Part.Position = Mouse.Hit.Position + Vector3.new(0,Part.Size.Y/2,0)
        Part.Anchored = true

Depending on the surfaces so if The TargetSurface was "Top" then

I would add it onto a position

This works but the problem is

This does not work well when a part is rotated. The surfaces will always be the same however their orientation will always be different.

Does anyone know how I can get a part always above the baseplate

This is for my placement system using Mouse.Hit.Position

The thing should be on top of the surface yet it just goes inside the surface.

Whats happening is The part is being placed at the exact center of my mouse and when I hover my mouse to a baseplate the exact position makes it so that it will exactly be the center and the part will go inside the baseplate.

I want it above the baseplate's top surface

Still Don't know what Im talking about?

Think about it like this

You have a plate with food on it.

It is "On It" not inside it

The food is supposed to be on the surface of the plate

In my case however the food is inside of the plate, the exact center of the plate

yet the food is inside of the plate because the position told it to go the exact center of the plate.

Answer this question