You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
Pickaxe when on equip to be facing the right way and in right position
What is the issue? Include screenshots / videos if possible!
Pickaxe no cooperate with me, I suck at CFrame
What solutions have you tried so far?
I tried looking at API Reference, just cant seem to get it right
So basically I’m here more or less for two things
In my game, I’m going to make it where you can (un)equip a pickaxe, I’m not doing a tool. There are a few reasons I’m not doing a tool.
a) It’s going to be the only thing a player uses in the game
b) I plan on making this game fully Xbox Compatible, having a toll will take away being able to use RB and LB buttons for anything game wise
c) I think it looks cooler
For some reason the animation I have for equipping the pickaxe glitches out and skips a frame, but this will probably be posted in a different post for animation support
This is my Test Pickaxe that I’m using: Fairly simple
I have it where when you join it gets placed on your back as such:
with this code
local playerpart = Player.Character.UpperTorso
local cf = CFrame.new(0,0,0.525)
local ori = CFrame.fromOrientation(0.15,0,2.3)
ThisPick.PrimaryPart.CFrame = playerpart.CFrame*cf*ori
module.NewWeld(playerpart,ThisPick.PrimaryPart,'CharacterWeld')
Now my inquiry will be this
I want it to where the pick part faces forward
and this is the code I have for it
local playerpart = Player.Character.RightHand
local cf = CFrame.new(0,0.4,-1.1)
local ori = CFrame.fromOrientation(200,-0.2,0)
local GetEquip = module.MainModule.Animations.EquipPickaxe
local GetIdle = module.MainModule.Animations.PickIdle
local EquipTrack = Player.Character.Humanoid.Animator:LoadAnimation(GetEquip)
local IdleTrack = Player.Character.Humanoid.Animator:LoadAnimation(GetIdle)
EquipTrack:Play(0,1)
EquipTrack.KeyframeReached:connect(function(neme)
if neme == 'GetPick' then
GetPick.PrimaryPart.CharacterWeld:Destroy()
GetPick.PrimaryPart.CFrame = playerpart.CFrame*cf*ori
module.NewWeld(playerpart,GetPick.PrimaryPart,'CharacterWeld')
GetPick.PrimaryPart.CFrame = playerpart.CFrame*cf*ori
elseif neme == 'Equip' then
GetPick.PrimaryPart.CFrame = playerpart.CFrame*cf*ori
IdleTrack:Play(0,1)
EquipTrack:Stop()
end
end)
Oh whoops, sorry. You can use CFrame.LookVector to get what direction the RightHand or HumanoidRootPart is facing, then use that to determine the CFrame for the pickaxe.
If you could give me an example,
Right now as in the video, I have it where it goes into the player hand, but positioning the CFrame of the handle including where I want the handle to sit in the players hand and the rotation of the pickaxe as a whole.
Since changing the Rotation of only the handle the Pick that’s welded to the Handle doesn’t follow it, so I have to resort to the CFrame
I don’t know what aspects of the CFrame itself I have to tinker with to be able to do that
Question, does the pickaxe change orientation based on which way you’re facing when you equip it? Or does it face the same way every time regardless of which way you’re facing?
What I do is when the Keyframe Reached of “GetPick” I destroy the weld the Pickaxe has (Which is welded to UpperTorso) then I set the CFrame of the pickaxe to the hand or well the spot I want it in and then Create a new weld to the characters hand, and for insurance I set it again after the weld
EquipTrack.KeyframeReached:connect(function(neme)
if neme == 'GetPick' then
GetPick.PrimaryPart.CharacterWeld:Destroy()
GetPick.PrimaryPart.CFrame = playerpart.CFrame*cf*ori
module.NewWeld(playerpart,GetPick.PrimaryPart,'CharacterWeld')
GetPick.PrimaryPart.CFrame = playerpart.CFrame*cf*ori
elseif neme == 'Equip' then
GetPick.PrimaryPart.CFrame = playerpart.CFrame*cf*ori
IdleTrack:Play(0,1)
EquipTrack:Stop()
end
end)
The pickaxe goes to the same spot no matter which way I’m facing
it’s just getting it to the right position and rotation
Now should I do the same thing for when it goes on to the back? with the math.rad?
because i kinda have the same concept on the back
I just feel like I could make the code and the placement of the pickaxe cleaner
local playerpart = Player.Character.UpperTorso
local cf = CFrame.new(0,0,0.525)
local ori = CFrame.fromOrientation(0.15,0,2.3)
ThisPick.PrimaryPart.CFrame = playerpart.CFrame*cf*ori
module.NewWeld(playerpart,ThisPick.PrimaryPart,'CharacterWeld')