Hi I’m having issues positioning and tweening the players camera relative to the player’s character
Essentially, I have the camera move around a player in a certain way.
The CFrame values of where it gets tweened to (not relative to the player), are stored in this directory
With the 0’s being CFrame Values.
I already wrote a script to grab these values and put them in order, with the correct timings, etc
I then convert those values to ones relative to the players HumanoidRootPart (or, I’m trying and failing to.)
frame.Values[0].Value:ToObjectSpace(workspace.Attacker.HumanoidRootPart.CFrame)
From my understanding, and from a different dev post, ToObjectSpace in my code would get the CFrame value of frame.Values[0].Value using workspace.Attacker.HumanoidRootPart.CFrame as it’s center or whatever (post)
After I get the “relative value”, I try to use it in a tween, which is here
local tween = ts:Create(cam, TweenInfo.new(anim.TweenTime, (anim.EaseType and Enum.EasingStyle[anim.EaseType]) or defaultEasingStyle, (anim.Direction and Enum.EasingDirection[anim.Direction]) or defaultEasingDirection, 0, false, 0), {CFrame = anim.cf * baseCF})
tween:Play()
with baseCF being the HumanoidRootPart.CFrame of the player
This doesn’t work, however as it bugs out.
This is the module script for the cframe values after I convert them to be relative to the player’s hrp
local module = {
["1"] = {
cf = CFrame.new(
2.236536026001,
-0.33886432647705,
-1.7070550918579,
-0.97449427843094,
0.11697659641504,
0.19151350855827,
0.17100921273232,
0.93969386816025,
0.29619494080544,
-0.14531618356705,
0.32139086723328,
-0.93573033809662
),
EaseType = "Sine",
Direction = "InOut",
TweenTime = 0
},
["2"] = {
cf = CFrame.new(
3.308479309082,
-0.52697420120239,
-1.5472059249878,
-0.95476937294006,
0.13794994354248,
0.26341104507446,
0.22210992872715,
0.91984766721725,
0.32333812117577,
-0.197693541646,
0.36721953749657,
-0.90888231992722
),
EaseType = "Back",
Direction = "In",
TweenTime = 0.38333333333333
},
["3"] = {
cf = CFrame.new(
5.8510627746582,
-1.360068321228,
0.6262035369873,
-0.60442328453064,
0.45618110895157,
0.65312474966049,
0.61487907171249,
0.78840857744217,
0.018358256667852,
-0.50655406713486,
0.41268891096115,
-0.75702780485153
),
EaseType = "Quad",
Direction = "Out",
TweenTime = 0.5
},
["4"] = {
cf = CFrame.new(
6.0742340087891,
-0.76872873306274,
1.1166210174561,
-0.80420315265656,
0.27896970510483,
0.52481734752655,
0.5287030339241,
0.73917531967163,
0.41724443435669,
-0.27153345942497,
0.61302179098129,
-0.74193924665451
),
EaseType = "Linear",
TweenTime = 0.51666666666667
},
["5"] = {
cf = CFrame.new(
11.056179046631,
-0.55068731307983,
4.6250858306885,
-0.1736481487751,
-0.33682405948639,
0.92541635036469,
1.4901161193848e-08,
0.93969261646271,
0.34202009439468,
-0.98480772972107,
0.059391181915998,
-0.16317600011826
),
TweenTime = 0.4
},
OffsetFromAttackerRootPart = CFrame.new(
0.7499885559082,
-2.7249999046326,
5.8500366210938,
0,
0,
-1,
0,
1,
0,
1,
0,
0
),
MaxAnimationIndex = 5
}
return module
OffsetFromAttackerRootPart is where the part starts relative to the hrp of the player
Any help would be appreciated, I’ve been trying to fix this but I havent had any luck, and yeah i was looking through older dev posts but I still can’t really understand it
For reference, this is what happens to my camera