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

How would you make an object look at another object but only on the y axis ( up or down ) ?

Asked by 4 years ago
Edited 4 years ago
-- Example 
object.CFrame = CFrame.new(object.Position, anotherObject.Position)

This line of code would make the object face the other object. But how would I make it only face on the y axis? I tried this :

-- Example 2
object.CFrame = CFrame.new(object.Position, Vector3.new(object.Position.X, anotherObject.Position.Y, object.Position.Z))

But that would make the object face the other object but not "look" up or down. Its kind of difficult for me to explain. Here is a drawn example ; https://gyazo.com/9b8226bbaaaf797e7c4fdd8f18ae025f

--[ HAS BEEN SOLVED IN COMMENTS, dont know how to set comment as answer so ]--

1
object.CFrame = CFrame.new(object.Position, Vector3.new(0, anotherObject.Position.Y,0)) royaltoe 5144 — 4y
0
thanks xXKillerMurderarXx 59 — 4y
0
might be wrong give me a second to test i can put it as an answer if you;d like? royaltoe 5144 — 4y

Answer this question