I wish just made copy location and copy rotation from one object to a armature pose bone but dont know.
If possible help me and tell if work bpy with runtime game for this.
In this code please look i think need just known how change mathutils object vector to target vector
import bge
import math
from math import *
import mathutils
t = 0
def rotate():
global t
# Get the whole bge scene
scene = bge.logic.getCurrentScene()
# Helper vars for convenience
source = scene.objects
# Get the whole Armature
main_arm = source.get('Armature')
ob = bge.logic.getCurrentController().owner
x = math.sin(t)
ob.channels['Bone.000'].joint_rotation = mathutils.Vector([0,0,math.tanh(-x)])
ob.channels['Bone.001'].joint_rotation = mathutils.Vector([0,0,math.tanh(x)])
ob.channels['Bone.002'].joint_rotation = mathutils.Vector([0,math.tanh(x),0])
ob.update()
for mesh follow the bone with weight p.
If you know how please help
Thanks
ive found that constraints dont work with added objects. setting the target didnt help either.
what did work is manually copying a localPosition to set the location of a armature channel pose. i dont think there is a way to work in world space. the armature needs to have an animation running on it(just dont animate the constrain bones), armature.update() doesnt work for added objects.
my problem is spawn my ragdoll friend.there have 15 bones with constrain copylocation and copyrotation target is one by one of rigid bodies objects please look my video
i try implementation kit of ragdolls but not working yet.Any simple alternative for spawn my ragdoll?The ragdoll error have a intanced group constrains not work
I find this code example to control bone with python
Please look if can adapt to my target rigidbody objects for can then spawn rigidbody objects intanced and can work?
I can’t figure out how to connect bones to an armature mesh so that I can control the armature through bones which are in turn controlled through python. I only have a code that controls bones so far
import bge
import math
from math import *
import mathutils
t = 0
def rotate():
global t
# Get the whole bge scene
scene = bge.logic.getCurrentScene()
# Helper vars for convenience
source = scene.objects
# Get the whole Armature
main_arm = source.get('Armature')
ob = bge.logic.getCurrentController().owner
x = math.sin(t)
ob.channels['Bone.000'].joint_rotation = mathutils.Vector([0,0,math.tanh(-x)])
ob.channels['Bone.001'].joint_rotation = mathutils.Vector([0,0,math.tanh(x)])
ob.channels['Bone.002'].joint_rotation = mathutils.Vector([0,math.tanh(x),0])
ob.update()
please friend if you know how do it please give me a north send me a small blend file or code for just 1 bone channel skinned working with copy location and copyrotation for i reapeat to my all 15 bones on my armature for finally spawn
YEAH is for dead zombie representation onlyI HAVE ALREADY THOUGHT IN A PALEATIVE SOLUTION WITH THAT HIS BUT I USE BLENDER 2.79 EVEN IF MY GAME LOADS THE LOT OF BUGS ON TEXTURES AND ANIMATIONS IN UPGE FOR NOW
will work on blender 2.79?May be suspend/restore dynamics?
In this case i will put the rigidbody with 15 objects, armature and mesh in main active layer invisible with suspend physics
this oblects not collide not exist in game but will put empty to center of mass of object is same scale of zombie then move tho position of zombie zombie endObject() then activate the physics put all to visible.
will try on monday in my work job.i will let you after results
after this physic complete need reset a ragdoll have possibility for use in another zombie in loop?
The time of total physic action is 4 secs or 240 frames then i need create a 4 copies of objects for work second by second then i will kill till 1 zombie per second without bug
try if possible look my project and if possible send me example of just 1 bone deforming correctly mesh with instance group for i repeat to another 14 bones
This is my blend compressed file link http://www.mediafire.com/file/ntaak…bie_ragdoll.7z
Just give 1 example of one bone spawned with constraints working and i will repeat for all 14 bones with constraints pose mode applying as rest pose.
Thanks a lot
In this code please look i think need just known how change mathutils object vector to target vector
import bge
import math
from math import *
import mathutils
t = 0
def rotate():
global t
# Get the whole bge scene
scene = bge.logic.getCurrentScene()
# Helper vars for convenience
source = scene.objects
# Get the whole Armature
main_arm = source.get('Armature')
ob = bge.logic.getCurrentController().owner
x = math.sin(t)
ob.channels['Bone.000'].joint_rotation = mathutils.Vector([0,0,math.tanh(-x)])
ob.channels['Bone.001'].joint_rotation = mathutils.Vector([0,0,math.tanh(x)])
ob.channels['Bone.002'].joint_rotation = mathutils.Vector([0,math.tanh(x),0])
ob.update()
for mesh follow the bone with weight p.
If you know how please help
Suspend/restore dynamics not work property.just made a lot of bad deformations on mesh.and without suspend get mesh is crazy movements without any control not good