Manually moving bones in code
Blitz3D Forums/Blitz3D Programming/Manually moving bones in code
| ||
Is it possible to directly manipulate bones in code, even while the entity is animating? I've tried to do this by storing a reference to the bone in it's own field, then manipulate it with standard Entity commands, although it doesn't seem to work. |
| ||
I'm pretty sure it does work because if you can get the Entity Info like it's X,Y,Z,Pitch,Yaw,Roll,Name, then you should be able to transform (move/scale/rotate) it too. Well now that I think about it, I have moved them. But if you move them and then you animate it, the vertices attached to the bones will move retardedly.... or maybe I just used ScaleMesh... hmmm But anyways, if you didn't know, you can use FindChild to get the bone using its name. |
| ||
You have to do all the bone manipulation after the 'update world" command, otherwise the updateworld command will override your own bone rotations. |
| ||
Ah. Thanks Matty. That was the problem! |
| ||
Yasha did some work on this a little while ago (coupla months before christmas? or so) If you dig up the threads he made (I think code archives too) you may find some useful stuff :) |
| ||
I've got it figured out. I wanted all but 1 bone(joint) to stay in the same animation, while the "thorax" bone's Yaw orientation could be controlled with code. I got it working right, although I did notice one thing: Turning the bone incrementally (say turn it's Yaw value .5 degrees) does absolutely nothing noticeable, as it is directed back to the original animation orientation on the next game loop. So, it does take a bit of coding to get the results I was looking for. What I am working on is an aiming animation, so no matter what animation the enemies\npcs are in, they can still aim at their target correctly. |
| ||
http://www.blitzbasic.com/codearcs/codearcs.php?code=660 this contains an example of moving bones manually |
| ||
"Smiffy" lives - hurrah! |