#need help with rotating spear

82 messages · Page 1 of 1 (latest)

wooden tree
#

I'm trying to attach a spear to my arm so it matches the arm's position and the root's orientation, ensuring it always points forward during animations. I’ve tried using AlignRotations and AlignPositions, but there's lag in position/rotation. I want to avoid using a RunService loop on each client to adjust the Motor6D, as this would still result in inaccurate server-side hitboxes.

I’ve attached a video showing what I want.

wooden tree
wooden tree
umbral oasis
#

Hhm?

#

You want it to always face forward

wooden tree
#

i have this rn, with a weldconstraint the rotation still changes when the arms rotation changes

if tool:GetAttribute("RootRelative") then
    local weldConstraint = Instance.new("WeldConstraint", weaponGrip)
    tool.Handle.CFrame = CFrame.new(weaponGrip.Position, weaponGrip.Position + root.CFrame.LookVector)
    weldConstraint.Part0 = weaponGrip
    weldConstraint.Part1 = tool.Handle
else
#

theres no difference from using a weldconstraint and a motor6d in my use case

#

since weldconstraints use cframes for offset it also rotates along

umbral oasis
#

How could the spear rotation not change

#

If the arm is moving

wooden tree
#

i want it to not rotate

#

its rotating with the arm rn

#

i want it to always look in the same direction as the rootpart instead

umbral oasis
#

I think its because its a tool handle

#

And they always grip to one arm or the other

#

You could try weld it instead to the root part aswell

#

To see if that change anything

umbral oasis
#

Cuz

#

It doesn't work

wooden tree
#

oh

umbral oasis
#

When I click on it

wooden tree
#

yeah wrong file i think

#

just the way spears work in deepwoken

umbral oasis
#

Could you send a clip of what yours is looking like

wooden tree
#

sure

#

there u go

umbral oasis
#

Ok don't name the tool handle

#

I mean

#

Change the name if the handle

#

Of*

wooden tree
#

i weld it manually

umbral oasis
#

To 'handle'

wooden tree
#

using a m6d

#

i automatically destroy the rightgrip that gets created when a tool gets added

#

heres the code i use for attaching it:

if toolInstance then
    local rightArm = player.Character:FindFirstChild("Right Arm")

    local root = player.Character.HumanoidRootPart

    local tool = toolInstance:Clone()
    tool.Parent = player.Character

    local weaponGrip = game.ReplicatedStorage.Assets.WeaponGrip:Clone()
    weaponGrip.Parent = tool

    local m6d = Instance.new("Motor6D")
    m6d.Part0 = rightArm
    m6d.Part1 = weaponGrip
    m6d.C1 = CFrame.new(0,1,0)
    m6d.Parent = weaponGrip

    if rightArm:FindFirstChild("RightGrip") then
        rightArm.RightGrip:Destroy()
    end
        --[[
        if tool:GetAttribute("RootRelative") then
            
        else

        end    ]]

    local weld = Instance.new("Weld")
    weld.Part0 = weaponGrip
    weld.Part1 = tool.Handle
    weld.C1 = tool.Grip
    weld.Parent = tool

    if WeaponType then -- this stuff isnt important
        tool:SetAttribute("WeaponType", WeaponType)
        player.Character.Humanoid:SetAttribute("WeaponType", WeaponType)
        animationsModule.Equip(player, "Weapon", WeaponType)
    end
else
    warn("Tool or FallBackTool not found in ServerStorage.")
end
umbral oasis
#

Ye try change the name of the Handle

#

To anything else

wooden tree
umbral oasis
#

The handle is welded to the players arm

umbral oasis
#

Idk if it will fix it or not

#

But you should try

wooden tree
#

??

umbral oasis
jovial turretBOT
#

studio** You are now Level 26! **studio

umbral oasis
#

And test

wooden tree
#

😭

#

then the tool just falls to the floor

#

the weapongrip is just a part that i use so that i can easily attach each weapon at the same spot

umbral oasis
#

And offset its cframe a bit to the right

#

So it lines up with the players hand

wooden tree
#

i had that earlier

#

but

#

okay

umbral oasis
#

without the part that does the welding to handle

wooden tree
#

dawg

#

then the weapon just stays in place if my arm moves

#

i want its position to still match that of the arm

umbral oasis
#

Hmmm

#

I'm actually out of ideas

#

Weld contrasting to the arm wouldn't work cuz weld constraints dont change its position

#

Welding to the arm would make it position with the arm but change direction

#

You tried alignment orientation right?

wooden tree
#

i could use alignrotation and alignposition, but id have to do it on each client

#

and idk i would get an accurate hitbox that way

umbral oasis
#

Hitboxing should always be done on client

#

With server sanity checks

wooden tree
#

fr?

umbral oasis
#

Yes

wooden tree
#

the way i handle it rn is still instant

#

but its on the server

umbral oasis
#

If you use server its fine but most games do client

#

Unless you want to make a server script which makes the align orientation

wooden tree
#

i can just fire all the clients when a spear weapon gets equipped

#

but its not ideal

#

and id still have to align the position in some way