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

how would I shift value "a" to value "b" using camera Y angle?

Asked by 2 years ago
Edited 2 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

Lets say I have two values. a = 1.5 b = 3 I want to shift value "a" to value "b" using camera Y angle. Yangle(360) = a when Yangle(180) = b I've figured out how to find camera Y angle, but still haven't got how to use Yangle in order to shift between values, for now I only used simple math.

local AngleY,TargetAngleY = 0,0

local Y = TargetAngleY - delta.x
TargetAngleY = (Y >= 135 and 135) or (Y <= -135 and -135) or Y

local dist = TargetAngleY - AngleY 
dist = math.abs(dist) > 180 and dist - (dist / math.abs(dist)) * 360 or dist 
AngleY = (AngleY + dist *0.35) %360

value = AngleY/180

it works quiet well, changing Y angle into 1 if Y angle is 180 or 2 if 360, but it only shifts between 1 and 2 counter clockwise, when I need it clockwise (or I want 90 to be 1 and 180 to be 2 as example), how could I acomplish that?

P.S: Reuploaded BECAUSE I LITERALLY WAITED 4 HOURS FOR SOMEONE TO HELP ME AND NOBODY EVEN BOTHERED

Answer this question