Y-axis snapping?

I’m away from Roblox until tonight so this is just something I want to talk over.

I’m attempting to familiarise myself with Mouse movements and their conversion from 2D to 3D space; however I’ve ran into a snag.

I’m working on a live movement system where a Part followings the Players Mouse.Hit.p - Though as expected, it only moves the part to where the mouse is hitting. I want to adjust this so during movement if the Player holds down a key and moves the mouse, the part will increase or decrease along the Y axis?

Is there any way I can do this?

1 Like

so wht u cn do is


part.Position = part.Position + Vector3.new(0,mouse.Hit.p.y,0)

edit: not rly sure if this is wht u want but yeeh vector3s have a property for x,y and z

Hey - I am familiar with this, thanks though!

Using this method won’t account for the mouse direction, whether the axis is + or - and will cause massive jumps due to the Mouse.Hit.Y axis.

1 Like
local height = 5
part.Position = Vector3.new(mouse.Hit.X, height, mouse.Hit.Z)

Then you can use user input to increase or decrease the height value

1 Like