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

Purely Conceptual, but how would i angle a wall based off two points?

Asked by 5 years ago
Edited 5 years ago

So what I am trying to do is rotate a wall based off two markers using the

CFrame.Angles(0, (math.atan2(Difx, Difz) * 180 / math.pi) ,0)

But that didnt work it was off.

So I tried...

math.atan(Difz / Difx) * 180 / math.pi

But that failed to work as well

``` *

[^] [ ]

      *

*

\^\ \ \

      *

```

1 answer

Log in to vote
0
Answered by
mc3334 649 Moderation Voter
5 years ago

Hello! To make a part face a direction, you need to use CFrames made from 2 vector3 values. This will show you how:

MovePart = INSTANCE part the will be moved  --This is the part that will be moved
Position = Vector3.new(1,2,3) --This will be the position of the part
LookTo = INSTANCE to look to --This will be the block the part rotates to

MovePart.CFrame = CFrame.new(Position, LookTo.Position) --The math to rotate the part.

I hop this helped. If it didn't, feel free to re-comment or post, and I will get back to you on it!

Ad

Answer this question