Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to disable vertical aiming?

What I am asking, is how do you disable vertical aiming, but keeping horizontal aiming?

1 answer

✓ Accepted answer

This isn't very precise mathematically. Let's make it so.


More or less, this means whatever we are doing, the y portion of the "aim" is ignored. For example, if the "aim" is the mouse's position in 3D space, then we just ignore its y position.

If it's displacement, again, just ignore the y; if it's a direction, again, ignore the y.


A simple way to "ignore the y" is to multiply it out to be 0:

dir = Vector3.new(0.4, 0.5, 0.3)
print( dir * Vector3.new(1, 0, 1) )
-- (0.4, 0, 0.3)

That turns the direction into something flat in the plane -- so it will ignore how much up-and-down there is, but still keep the other senses of direction.

2 comments

0

How exactly would I use this, Blue Taslem?

0

If you have a direction or a displacement, the multiplication "flattens" it. Then use the "flattened" direction instead of the original one.

This discussion is preserved as it was. New answers, comments, and votes are closed.