Is it possible to do slow-parenting, or similar effect, on just parts of a mesh in BGE?
I’ve tried things like hooks and armatures, but those rely on constraints that the BGE doesn’t handle.
I can do it fine using animations, but would rather not pre-bake it and have glitches when switching actions, and would like things (eg. hair) to just go with arbitrary wind gravity and momentum.
I’m working on a script for it, but it doesn’t work yet, and if there’s a better way then I’d rather not reinvent too many wheels!
I think to do this youd need to use python to set the position of each bone, (or the position of each vertex)
Both are possible, btw, spent some time fixing the api for setting armature bones last nigh so for 2.49a you can get/set the loc/size/quat for each bone.
With this you could have do a slow parent in python or even make the bones follow a slow parent chain of empties. its a bit crap that it needs python but better then nothing.
I’m not sure of the performance hit, but the game engine supports softbodies. Maybe try those? The bathroom demo shows a good implementation using a shower curtain as an example.
I have to say that it’s an area of Blender that I’ve not had chance to play with properly yet though.
Edit:
:eek:
Got distracted when posting and when my post comes up I see a magical post by ideasman42!
get/set the loc/size/quat for each bone.
In the game engine??
This means rag doll deformation of a solid mesh is just a few lines of code away! A proxy rigid body ragdoll could be tracked by the armature by setting bone location/rotation based on the location/rotation of the rigid body setup.
Wow. I didn’t think this would be possible. I should read my signature more often.
I should make a demo of how this can be used - but for now since you guys seem interested heres the commit log…
Revision: 20937
BGE Action Actuator setChannel() function was broken in a number of ways.
extract_pose_from_pose only checked one of the list items for NULL when looping over them yet its possible they are different sizes.
game_free_pose needed to be used rather then MEM_freeN, channels would never be freed leaking memory.
setChannel() would make a new pose that wasnt aligned with the existing pose, the lists are assumed aligned so when extracting the channels its unlikely this was ever useful.
Added getChannel() - returns pose loc/size/quat
Added option args for setChannel(channel, matrix) or setChannel(channel, loc, size, quat)
I’ll try the scripted armature approach. I want more control than softbody, and armature should be fast and low maintenance. Also limiting distance and rotation is easy, no polygon collision. And with a script I can go by time rather than number of frames like slow parent.
I think I have a finished sketch of the script - now I gotta look just about everything up in the API reference.
I’m doing high-poly (~ 10K) hair that works in the game engine. I can get good bounce and flop in animations (walking, running, turning and falling etc.), but would rather put it on auto-pilot.
Of course it’s too slow for a bunch of characters, but easy enough to make LODs (1/4 as many hairs twice as thick)…
Any bets on whether particle hair will work in BGE before I get this working?
to have this working really well you want to be able to set each bone loc/size/rot OR matrix in worldspace.
At the moment the values are relative to the rest pose of the bone. which isnt that useful especially since you cant get the rest pose of the bone.
I could add the rest pose so its possible to work out how to place a bone in worldspace, but then you also want the paretn relative position… and it gets complicated…
SO - Maybe an easier approach would be just to support bone constraints so you can constrain a bone to an object.
Later on we could have a full armature api in the BGE but its late and Im not about to write one before 2.49a which will probably be released tomorrow.
I was just looking for loopholes, not trying to make you work harder!
The demo looks like just what I was after. Fairly simple rig for starters, a ‘for now’ solution.
Thanks, for this, and the bazillion other cool things you’ve done!
Dave Heinemann, 3rd year noob.
Q:
so y isn’t it working on mine?
A:
i have 2.49 RC2
Revision 20953 is way past RC2. Update - there’s plenty of changes, and, for me anyway, RC2 was the buggiest version of 2.49.
Sometimes new features are referenced that have been added in the last day or so, in these cases you need a blender built after the features are added of course, using the SVN commit revision is the normal way to check if your blender version is new enough.
This will work in 2.49a (which is not released yet) not 2.49
if you get a build from graphicall that is built after r20953 you can test before 2.49a is released.
To check the revision click on the blender icon that shows the splash at the bottom in the middle youll see a number there like Rev-20123 or something.