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

how to move an object in 3d by using only angles?

Asked by 3 years ago

what math methods should i use to get the direction?

01i=0
02m=1000
03 
04angX=script.Parent.Orientation.X;--90
05angY=script.Parent.Orientation.Y;--0
06angZ=script.Parent.Orientation.Z;--0
07 
08dirX=math.cos(math.pi*angX/180)
09dirY=math.sin(math.pi*angY/180)
10dirZ=math.tan(math.pi*angZ/180)
11 
12print(dirX)
13print(dirY)
14print(dirZ)
15 
View all 22 lines...

i tried switching around the cos sin tan log methods but no sucess

0
forgot to put in i=i+1 in line 20 fullguyblox3 69 — 3y
0
what do you want to make, also what's the dirX, dirY, dirZ in your output Xeqro 20 — 3y
0
i wanted to make a rocket thing where the angle slowly decreases so i made this test first because i didnt know how to get the direction in 3d also the dirX,dirY,dirZ are the directions that i made like in 2d e.g( dirX=math.cos(ang) dirY=math.sin(ang) ) fullguyblox3 69 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago

Why don't you use CFrame? Part.CFrame.LookVector is might be what you are looking for and is easier to operate with. I don't know these methods you are using very well, but CFrame is a very good solution and it returns pretty much same resulst as you would expect with your method.

01i=0
02m=1000
03 
04lookVector = script.Parent.CFrame.LookVector
05print(lookVector)
06 
07repeat
08    wait(2.5)
09    print('wow')
10    workspace.launchingparttest.Position = workspace.launchingparttest.Position + lookVector
11 
12until i>=m
13--doesnt move

Also I am not sure but the reason why your method is not working is bc roblox uses Tait–Bryan angles instead of Euler angles (it's said here)

0
thanks! works great fullguyblox3 69 — 3y
Ad

Answer this question