How do I replicate Real Arm movements to Fake Arms (ViewModel)?

image
:thinking::thinking:

Hmm may be a problem with my math. Try using the Inverse of Part0.CFrame instead of the Inverse of camera.CFrame.

Seems that the Offset and the way it rotates is wrong?
https://gyazo.com/a90fcd07dcd36e299292149a4bc5ff0a

I highly considered and attempt this idea (Which is the one from @Hexcede), it’s a fact that it doesn’t require any hacky way, including creating new rigs.

I low-key achieved what I want it to be, I sightly modified the rig that you gave me and I found it differs and offset from the real character rig, that’s probably the reason why it offsets a little bit.
After that I modified the CFrame and now it seems to be working fine! What I need to do now is replicate the weapon to the ViewModel. It might be a little bit frustrating because I do not use the legacy Right Grip by the default Roblox Tool. The tool is connected to the Torso by Motor6D. I’m considering on connect to a real part that’s similar to the ViewModel’s Torso, maybe HumanoidRootPart or I’ll create a new part.

https://gyazo.com/d249bc2da5f152a682046980e9fbf33a

3 Likes

If you want the gun to attach to a seperate viewmodel on the client you can simply change the Part1 (might be Part0) of the RightGrip weld to attach to the viewmodel in a LocalScript. That should not unequip the gun from the player so you should have the gun attached to the fake arms.

As long as the tool remains parented to the character you should be fine.

1 Like

I modified the legacy Roblox tools, I do not use the RightGrip weld, instead, I used a Motor6D that connect the Torso and a part named “BodyAttach” inside the weapon. It acts like a handle in terms of Roblox legacy tool.

FYI check out this:

My current problem is how do I clone the tool to the ViewModel with all the CFrame positioining correct and animations being played.
Right now during the RenderStep, I’ll check is there a tool inside the player, if yes, I’ll clone it to the ViewModel.
@ScriptingSupport You might want to check out this problem since you are more familiar to this ViewModel.

I also added a new Motor named “ToolGrip”, which is exactly the one that the real character uses to connect the tool and the torso. I directly copied it from the real character so they should be the same, this is the ViewModel right now.
image

This is the Rig, which is same as the character’s one.

	if Character:FindFirstChildOfClass("Tool")~= nil and ViewModel.ReplicatedWeapon.Value == false then
		ViewModel.ReplicatedWeapon.Value = true
		local a = Character:FindFirstChildOfClass("Tool"):Clone() -- Clone the entire tool
		for i,v in pairs (a:GetChildren()) do -- Put the tool inside a model
			v.Parent = ViewModel.VMWeapon 
		end
		
		ViewModelRoot.ToolGrip.Part1 = ViewModel.VMWeapon:WaitForChild("BodyAttach")
		
	end

It did clone it and put it inside the ViewModel, however, it’s position is completely wrong.

I tried to use the transform property on ViewModel’s ToolGrip Motor to the real character.Torso.ToolGrip motor, however nothing changes. The gun animations such as pulling out the magazine is not even showing, how do I resolve this?

This is probably the final step of this entire ViewModel, thanks for helping :wink:

4 Likes

Can’t you just reconnect the tool on the client? There’s no need to clone it if you don’t have to.

You mean Attach the ViewModel ToolGrip Motor to the Tool’s BodyAttach?

I mean attach the weapon to the viewmodel arms instead of anywhere on the character. If you do that client side the player should see the tool properly.

I can’t get the view model to stop pushing the character. To have this compatible with R15 would I have to write a script that glues the arms to the humanoidrootpart?

Yeah, performing that should be better than cloning the weapon, however the animations did not even replicate.

if Character:FindFirstChildOfClass("Tool")~= nil then
	Character.Torso.ToolGrip.Part1 = nil
	ViewModelRoot.ToolGrip.Part1 = Character:FindFirstChildOfClass("Tool").BodyAttach
	ViewModelRoot.ToolGrip.C0 = ViewModelRoot.ToolGrip.C0 * CFrame.new(0,0,0)
end

1 Like

You shouldn’t need to change the C0. Just the Part1. If you attach it to a part in the same location as the root the offset is the same.

Edit: I was misreading your snippet sorry
Can’t you simply use the ToolGrip already there instead of using one separate from the character?

1 Like

If I use the original ToolGrip then it won’t follow the camera like the arms? ViewModel also use a separate Motor6D though

1 Like

I mean reattach the original ToolGrip on the client to the arms of the viewmodel (as in the ones that move with the camera.)

My custom ToolGrip is parented to the character’s Torso though, it’s Part0 is Torso and Part1 is BodyAttach.

Edit: I tried, The Part0 of Torso’s BodyAttach is ViewModel’s Root now, The Part1 remains the same (Gun’s BodyAttach) However, the animations of BodyAttach are not replicating. only parts inside the gun such as Magazine drop and moving bolt are working.

From the GIF, you can see that the BodyAttach base part is not moving (The recoil animation) but the reloading magazine are working fine, does this have to be done by renaming the Motors?
(I temporary attached Part0 to a random part in workspace such that the weapon will be visible.)

https://gyazo.com/e9fad2fac532148dd7161b521bce1e09

Edit: It’s fixed and all fine!
Turns out the ViewModel’s Root name has to be exactly same as “Torso”, which is the name I use when animating it. It works now and thanks for everyone help!
https://gyazo.com/ac5c35f2bb7053293a0c1cabeb4e5d80

10 Likes

I’m still having problems without putting tool into the player’s arms.
I have the arms working, but the tool is pretty hard.

I have tried all steps, Headstackk said, with no success.
Also, I’m trying to make is as tool. I think Headstackk did too.
I don’t even need animations now, I’ll be just happy if it would be in the hands. I can animate it later.

1 Like

May you please share the new offsets/CFrames with me because I am unable to figure it out. I’ve tried doing quite a bit!

Thank you!

1 Like

What problem are you having? I’m not quite sure which CFrame to share.

The arm offset problem in post 50.

The one in posts 50 is not a Viewmodel!
That’s from:

1 Like