Okay so I have a police character model here in blender:
And I added something to the rig, it’s a shotgun. I need help to completely glue this shotgun to the hand bone permanently. Because when I import some animations to blender, the shotgun does stay on the hand bone.
Here is a screenshot:
As you can see in the screenshot, the shotgun is attached to the hand bone. I play the animation in blender, the weapon stays there.
Now I export it as .fbx then import it to roblox.
The right is imported with the shotgun as well. Now for the animation.
Null pose/animation:
Imported animation:
It’s just weird. Why does the shotgun not stay on the hand if I import it to roblox? Or there must be another way to really “glue” the gun permanently to the hand.
Look at blender, compare to roblox:
Look to the right, you can see I used an object constraint. A “child of” constraint. The target is the main skeleton of the rig, the bone is the right hand bone.
How else am I gonna glue that gun to the hand bone. Any ideas, suggestions, etc, reply below!
2 Likes
Problem solved. I had no choice but to manually track the handbone’s cframe. By using “TransformedWorldCFrame”.
First of all I export the shotgun as a separate skinned mesh. Then import the .fbx file to roblox, with Constraint Details and Draw on Top enabled, you can see the bones.
Then I make a small part, it will act as the primarypart of the weapon. Named it “Root”. Then I welded it to the weapon body itself. The mesh named “XM” is the shotgun.
There are a lot of ways to weld stuff. I used a plugin to make life so much easier.
There we go, all the needed stuff is welded to the primarypart.
Now I add a code. The code will track the TransformedWordCFrame of the HandBone, every frame it will force set the primarypart’s cframe to the TransformWorldCFrame.
The results:
The code:
local RunService = game:GetService("RunService")
while true do
wait(RunService.RenderStepped)
workspace.PoliceModel.Shotgun.PrimaryPart.CFrame = script.Parent.TransformedWorldCFrame * CFrame.new(0,0,-0.09)
end
That’s what I mean of “every frame”, with the help of RunService, RenderStepped fires every frame. The code contains a loop that will track the HandBone then force position the shotgun to the hand.
Because of my persistent researching, I got an idea that might fix the problem it did work.
With “TransformWorldCFrame” that property is the real cframe of the bone when it gets animated.
Source: Skinned Mesh doesn't work with tools - #13 by banktoner
2 Likes