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

Changing just the Y orientation out of x,y,z?

Asked by 6 years ago

So I'm writing a script involving the changing of the Orientation property/ The problem is it's multiple parts, all with different Z orientations that I don't want to mess with - I only want to change the Y. Can I change just the y part of the property without interfering with x and z? If so, how?

Thanks.

2 answers

Log in to vote
0
Answered by
RayCurse 1518 Moderation Voter
6 years ago
Edited 6 years ago

In order to change only one axis of rotation without affecting the other axes, you can add the original vector with a new one. For example, the following would increase only the y axis of the vector by five:

local vector = part.Orientation
vector = vector + Vector3.new(0 , 5 , 0)
part.Orientation = vector

Adding vectors is just adding the individual components of the vector operands. For example, Vector3.new(1,2,3) + Vector3.new(4,5,6) would equal Vector3.new(1+4 , 2+5 , 6+3).

0
Thank you so much!! clairecrystal 2 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

just type .y after the thing...

example:

part.position.Orientation.y = #

0
The y property of Vector3 is read only. RayCurse 1518 — 6y

Answer this question