Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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!

2 comments

0

it did not help but ty

This discussion is preserved as it was. New answers, comments, and votes are closed.