Crygen54
(Crygen)
June 27, 2023, 7:07am
#1
Hello there!
I’m stuck onto a small problem which i’m having trouble to fix it.
I searched solutions multiple time on the forum but i didn’t found what i’m exactly looking for.
What i want is to rotate the "Waist"
motor6D from the "UpperTorso"
of players character to make it facing to the enemie npc "HumanoidRootPart"
position.
I want to rotate the waist only on the X axis, to make it Up and Down.
I tried some things like:
Waist.C0 = CFrame.lookAt(Waist.C0, Vector3.new(EnemieRoot.Position.X, Waist.C0.Y, Waist.C0.Z))
-------------------
Waist.C0 = CFrame.lookAt(UpperTorso.Position, Vector3.new(EnemieRoot.Position.X, UpperTorso.Position.Y, UpperTorso.Position.Z))
-------------------
Waist.C0 = CFrame.Angles(EnemieRoot.Position.Y, 0, 0)
-------------------
Waist.C0 = CFrame.FromOrientation(EnemieRoot.Position.Y, 0, 0)
And more… i tried many possibilities
Help would be apreciated!
Here is some images of what i’m looking for:
This is how it is actualy
This is how i want it to be
1 Like
Crygen54
(Crygen)
June 27, 2023, 7:45am
#3
Thank for your help!
Found the solution on this post, which is related to the post you gived me ^^
I’ve been working on a script where Arms, torso, and the characters head follows the mouse
The issue I am experiencing is that the script i have already moves the whole character.
local plr = game:GetService("Players").LocalPlayer
game:GetService("RunService").RenderStepped:connect(function()
if plr.Character then
local root = plr.Character.HumanoidRootPart
if root then
root.CFrame = CFrame.new(root.CFrame.p,root.CFrame.p+Vector3.new(cam.CFrame.lookVector.X,0,cam.CFrame.lookVector.Z))…
So i edited the script a little bit and… here is the solution (in case if someone also need it):
--Getting variables
self.Waist = self.Character:FindFirstChild("Waist", true)
self.UpperTorso = self.Character:FindFirstChild("UpperTorso", true)
--Running code with RenderStepped
if EnemieRoot and Waist and UpperTorso then
local Distance = (UpperTorso.CFrame.p - EnemieRoot.Position).magnitude
local Difference = UpperTorso.CFrame.Y - EnemieRoot.Position.Y
Waist.C0 = CFrame.Angles(-(math.atan(Difference / Distance) * 0.75), 0, 0)
else
Waist.C0 = CFrame.Angles(0, 0, 0)
end
system
(system)
Closed
July 11, 2023, 7:46am
#4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.