I am making a sword fighting game, the main mechanic is rotating the sword,
here is an example
my problem is that when i tried applying it to the player i realized that it only works as intended in one direction
How does this work ?
it takes the position of the guielement in the middle of the screen, uses math.atan2 to find an angle, (this part works fine)
i then send it to the server and apply a cframe to the sword to make it rotate correspondingly
to be more precise i use sin and cosin to find the x and y of the point im using to change the cframe of the sword (this is the part that only works in one direction)
here is the code simple
local position = script.Parent.axis.Position
local lookingvectorx = math.sin(angle)*15
local lookingvectory = math.cos(angle)*15
local lookingvector = Vector3.new(lookingvectorx,lookingvectory,0)
script.Parent.axis.CFrame = CFrame.new(position,position+lookingvector)
to reiterate im stumped on the maths behind making this relative to another position
on a sidenote this doesnt look as horrible when using a more blocky character
