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

How to disable vertical aiming?

Asked by 9 years ago

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

1 answer

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

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.

0
How exactly would I use this, Blue Taslem? TheRings0fSaturn 28 — 9y
0
If you have a direction or a displacement, the multiplication "flattens" it. Then use the "flattened" direction instead of the original one. BlueTaslem 18071 — 9y
Ad

Answer this question