Thanks man! I was struggling very hard trying to fin a way to just rotate a Bone. In my case I used "get_bone_global_pose_no_override()" instead of "get_bone_global_pose()", because the a Bone that I wanted to rotate scaled down and lost its original normal position. That way I just modify the Rotation from the Basis of the Transform3D that I got using "get_bone_global_pose_no_override()" then apllied using "set_bone_global_pose_override()"with that same arguments you shown and problem solved. And again, thanks for providing the code!
you don't need to do the -Z thing..but it will add a few lines of code to cast the rotation to a var add 180deg on y and recast to the rotation...it's 2-3 lines tops...but I just can't model in blender backwards :)
I should have pointed that this video will provide different results because your bones will be completely different than mine, so many issues can impact bones, like unsafe transformations with scalling, import issues, export issues, rig issues, relationship issues between bones, constraints being applied wrong, the simple answer to your problem is to isolate it, make a new brand skeleton in Blender and see how it works with your code, if it works then try to find the issue with your rig or bones, if it doesn't work and the skeleton is very basic, something is wrong with the code.
Hey great tutorial thank you. I wanted to learn how do you view the bones x,y,z axes in blender I couldn't for the life of me find anything related to explain it . Most roll bone tutorials feature it and I can't see it on screen without knowing how to enable it.
this is exact problem that i was trying to solve. i couldn't figure out how to get the actual global transform of the bone. thanks for the video! what about performance impact? isn't doing this in physics_process for many units going to be expensive?
Not really, by default on a blank project maybe, because the physics process by default is fixed at 60 frames per second, this means the function will be called 60 times per second, but you can change the physics frame rate on the project settings, on my RTS project, the physics framerate is smaller, because I am not using physics all that much due to perfomance of units collisions, If you use process() function, then it's based on the framerate of the game, nothing to do with the physics framerate, and if you are not using vsync that will lock your fps to 60 or 144, then the function can get called up to your framerate x times per second, if the fps is free, sometimes it goes up to 800 because perfomance is fast, which means it will call the process() function 800 times per second per object, then yea, it's a waste of perfomance. If you want to optimize this, you can create your own tick system, with an integer you can use the process function or the physics to determine a frequency by counting if that integer is at a given point, if not then increase by +1, if it is then reset back to 0, this way you only execute code at intervals you specify. Or just use a timer to update, another way to also control the frequency. On my project I tested with physics process for all the 300 units or so I am prototyping all using this looking_at code, and the perfomance got hit around 3~4 fps, good enough for me. This of course depends on your asset, polygon count, bone count, animation, and a lot of other things, my asset is optimized a bit,
Hey mate. Great video here, I have question: I've rigged a vehicle in blender, can I use the same approach to move the wheels bones to the position of the simulated ones?
The video show how to make bones look towards a given target using look_at with pose override, I don't know what type of vehicle you are trying to simulate but I believe you can do it like that, however I would advise you to look into Godot nodes that handle the physics simulation of vehicles, like VehicleBody3D, they should take care of the things you need to make a car in Godot,
You don't, you probabilly want a axis from the transform, or the position of the transform, the transform itself is a structure that represents the combination of position + rotation + scale of anything in 2D or 3D, let's assume it's 3D. The transform does this by having a origin, which represents the position, which in code is The3DObject.transform.origin or The3DObject.position, and if you want the global transform or the global position of a transform, you call The3DObject.global_transform.origin or The3DObject.global_position. The rotation and scale are defined through a basis, which is a structure that will tell how something is scaled and rotated in 3D, the same concepts apply for 2D transforms but with one less axis. When you say you want to convert a transform into a vector, you can request the position of the transform, or a given axis from the rotation through the basis, Here are some useful links: docs.godotengine.org/en/stable/tutorials/3d/using_transforms.html docs.godotengine.org/en/stable/classes/class_basis.html
Godot IK and bones has been through a lot of reworking with github devs like lyuma and tokage on github, I have hopes we will have a nice working IK system in the future,
One of the most underrated channels... Simple straight to the point
Good stuff! Thank you for sharing this, much appreciated.
Thanks man! I was struggling very hard trying to fin a way to just rotate a Bone.
In my case I used "get_bone_global_pose_no_override()" instead of "get_bone_global_pose()", because the a Bone that I wanted to rotate scaled down and lost its original normal position. That way I just modify the Rotation from the Basis of the Transform3D that I got using "get_bone_global_pose_no_override()" then apllied using "set_bone_global_pose_override()"with that same arguments you shown and problem solved.
And again, thanks for providing the code!
Excellent tutorial, thank you!
saved me sooo much time dude, excellent tutorial🙌
you don't need to do the -Z thing..but it will add a few lines of code to cast the rotation to a var add 180deg on y and recast to the rotation...it's 2-3 lines tops...but I just can't model in blender backwards :)
absolute king - thank you
when I put, the bone drastically changes scale and I noticed head pos is snapped in place instead of following other bones's animation
I should have pointed that this video will provide different results because your bones will be completely different than mine, so many issues can impact bones, like unsafe transformations with scalling, import issues, export issues, rig issues, relationship issues between bones, constraints being applied wrong, the simple answer to your problem is to isolate it, make a new brand skeleton in Blender and see how it works with your code, if it works then try to find the issue with your rig or bones, if it doesn't work and the skeleton is very basic, something is wrong with the code.
Hey great tutorial thank you. I wanted to learn how do you view the bones x,y,z axes in blender I couldn't for the life of me find anything related to explain it . Most roll bone tutorials feature it and I can't see it on screen without knowing how to enable it.
It's in the armature data > Viewport Display > [ ]Axes, the stickfigure icon when you select a armature; imgur.com/a/Rkt5xZ2
@@nanotechgamedev worked great thanks alot
this is exact problem that i was trying to solve. i couldn't figure out how to get the actual global transform of the bone. thanks for the video!
what about performance impact? isn't doing this in physics_process for many units going to be expensive?
Not really, by default on a blank project maybe, because the physics process by default is fixed at 60 frames per second, this means the function will be called 60 times per second, but you can change the physics frame rate on the project settings, on my RTS project, the physics framerate is smaller, because I am not using physics all that much due to perfomance of units collisions,
If you use process() function, then it's based on the framerate of the game, nothing to do with the physics framerate, and if you are not using vsync that will lock your fps to 60 or 144, then the function can get called up to your framerate x times per second, if the fps is free, sometimes it goes up to 800 because perfomance is fast, which means it will call the process() function 800 times per second per object, then yea, it's a waste of perfomance.
If you want to optimize this, you can create your own tick system, with an integer you can use the process function or the physics to determine a frequency by counting if that integer is at a given point, if not then increase by +1, if it is then reset back to 0, this way you only execute code at intervals you specify.
Or just use a timer to update, another way to also control the frequency. On my project I tested with physics process for all the 300 units or so I am prototyping all using this looking_at code, and the perfomance got hit around 3~4 fps, good enough for me. This of course depends on your asset, polygon count, bone count, animation, and a lot of other things, my asset is optimized a bit,
@@nanotechgamedev thanks so much for a detailed reply.
i'm learning godot and your videos are incredibly helpful!
THANK YOU SM
you are amazing!
Hey mate. Great video here, I have question: I've rigged a vehicle in blender, can I use the same approach to move the wheels bones to the position of the simulated ones?
The video show how to make bones look towards a given target using look_at with pose override, I don't know what type of vehicle you are trying to simulate but I believe you can do it like that, however I would advise you to look into Godot nodes that handle the physics simulation of vehicles, like VehicleBody3D, they should take care of the things you need to make a car in Godot,
Godot is still fresh, so there is plenty of experience to make
thank you!
how do you covert a transform into a vector?
You don't, you probabilly want a axis from the transform, or the position of the transform, the transform itself is a structure that represents the combination of position + rotation + scale of anything in 2D or 3D, let's assume it's 3D.
The transform does this by having a origin, which represents the position, which in code is The3DObject.transform.origin or The3DObject.position, and if you want the global transform or the global position of a transform, you call The3DObject.global_transform.origin or The3DObject.global_position.
The rotation and scale are defined through a basis, which is a structure that will tell how something is scaled and rotated in 3D, the same concepts apply for 2D transforms but with one less axis. When you say you want to convert a transform into a vector, you can request the position of the transform, or a given axis from the rotation through the basis,
Here are some useful links:
docs.godotengine.org/en/stable/tutorials/3d/using_transforms.html
docs.godotengine.org/en/stable/classes/class_basis.html
@@nanotechgamedev thanks so much
Im new to this channel by the way. For answering my question, and having amazing content, you just got a new sub
I wish Godots IK system wasn't terrible
Godot IK and bones has been through a lot of reworking with github devs like lyuma and tokage on github, I have hopes we will have a nice working IK system in the future,
Next time make a little window so we can't see it at all
Ctrl and Plus will increase browser's size with video player. Or just use Zoom in any browser
@@ZeroStas it's visible fine except of a part code on right side that hidden behind the screen
may you ebashit in russian yazyc? )
nahuya
@@Papajoofable ok. ofc. pizdato anyway ) thank you. Ay dzhust podyebate )
Doesn't work, unfortunately. Still a good video