I’ve been having two issues while trying to tween an object’s size and position.
Whenever I try to change the size of a part in a certain direction such as on the Z axis, the part instead scales on the Y axis instead. However, this is fixed when I change the orientation of the part to (-90, 0, 0) which makes no sense to me, although I would greatly appreciate if someone could explain this to me. Currently, the default orientation for the part is (0,0,0) and I hope to keep it that way so I’d rather not leave the orientation at (-90, 0, 0) to fix this issue.
CURRENT CODE SEGMENT
local PartTweenGoal = {
Size = Vector3.new(10, 100, 10)
--Position = Part.Position + Vector3.new(0, 0, -50)
}
In this situation, the part scales 100 studs on the Z axis despite being told to scale on the Y axis.
In order to counter the part scaling in both directions, I added another key in “PartTweenGoal” which would move the part half the length of the part’s size forward on the Z axis. However, this creates another problem where the part doesn’t move on the Z axis relative to the player’s LookVector and instead only moves on the Z axis relative to the baseplate. So how would I go about making the part move (X) studs in the direction of the player’s LookVector?
CURRENT CODE SEGMENT
local PartTweenGoal = {
Size = Part.Size + Vector3.new(10, 100, 10),
Position = Part.Position + Vector3.new(0, 0, -50)
}
I’ve tried that, I apologize for not mentioning in the post, but the reason why I’m increasing the position as well is to give the illusion that the part is only scaling in one direction. However, using this method doesn’t work for my situation.
If you want to create an illusion of the part scaling in one direction, you should probably move it relative to itself. And if you also want the position to be relative to the humanoidrootpart, you can remove (-) the position of the CFrame and then add (+) the desired position.
I tried both methods however none of them seemed to work, I’m not too good with CFrames so it’s a bit tricky for me to understand what this line of code is actually doing.
Is the part supposed to look like it scales in one direction but doesn’t move? Because if you want it to look like what happens when you use the scale tool in studio, maybe just doing this will work.
Pretty much yea, It technically does move as I’m tweening the position as well, but because it scales in both directions it creates the illusion that it isn’t.
I’m still having the same issues with the new method you just sent, as it seems that using CFrame in general keeps glitching out my tween for whatever reason.
Based on the latest video you sent, the part seems to move downwards. Have you tried changing the order of the values in CFrame.new(0, 0, 50)? Maybe this would do the correct thing. Because the size is changed on the part’s Y axis, the position should be changed on that too.
That was actually one of the issues I stated in the original post. Although I haven’t tried changing the order of the values, is there a potential fix or reason for whats happening?
Well, the first problem you mentioned seems quite odd. So… when the orientation of the part is (0, 0, 0), it scales vertically when you change the Z coordinate (last coordinate) of the size? If that’s what happens, I don’t know what could be the reason.
That actually did seem to fix the problem, however the first time I activate the ability it glitches out like how it originally did in the GIF’s I sent you. Although this issue might be coming from somewhere else, I have a few guesses from where.
Nevermind, it seems that it still locks on to the Z axis relative to the world space. I’m completely stumped on this, I don’t have any idea on how to fix this.
But yea, you’re exactly right. If the orientation is (0,0,0), the Y and Z axis gets switched up for some reason, I have to manually change the orientation to (-90, 0, 0) for it to be fixed. I’m not sure if this is a bug or if I’m somehow missing something.