VeTaL Posted June 24, 2011 Share Posted June 24, 2011 Found old thread: http://www.leadwerks.com/forum/viewtopic.php?f=1&t=5941 According to Josh, the EntityParent should work, but for me it broke the animation, so that it only animated a few frames anymore. I'm starting to work with attaches, now just collecting info.. any news on it? Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
Canardia Posted June 24, 2011 Share Posted June 24, 2011 I don't know if it's fixed, or was it ever broken, or did I do something wrong, but it just didn't work for me, so I had to use SetEntityMatrix(model,GetEntityMatrix(bone)) instead. But if your animation suddenly doesn't work anymore, try unparenting models from the bones first. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
VeTaL Posted June 24, 2011 Author Share Posted June 24, 2011 Thanks, i'll test it and share results. Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted June 24, 2011 Author Share Posted June 24, 2011 Warning, achtung, внимание !!! Take out your wifes and childs from monitors. The first test starts: TEntity sword = LoadModel ("medievalweapons_longsword.gmf"); EntityParent(FindChild(mi1->GetModel(),"Bip01 Spine"),sword,1); Control: press 1-2-3 to run different animation loops. Starring: crawler, sword. :D Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
Canardia Posted June 24, 2011 Share Posted June 24, 2011 Yeah, exactly the same problem as I had. I attached hair to a model, and after that only the pelvis moved, making a nasty animation Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
VeTaL Posted June 24, 2011 Author Share Posted June 24, 2011 Dont think that its expected to work in this way - looking like a bug. Added to bug-report - i think, Josh should check it ( http://www.leadwerks.com/werkspace/tracker/issue-185-5-parenting-to-bones/ ) Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted June 24, 2011 Author Share Posted June 24, 2011 But honestly, i think attaching should be in next way: we're taking vertex 1 on the hand and placing sword there. then we're taking vertex 2, make vector and align word with that vector at last, we're taking vertex 3 to create third point, which would fix our sword in all 3 dimensions Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted June 26, 2011 Author Share Posted June 26, 2011 Second test: SetEntityMatrix(sword,GetEntityMatrix(FindChild(mi1->GetModel(),"Bip01 R Hand"))); this works fine, no need in 3 points... but i wish parenting get work: while attaching there is need in delta-position So, now i will need to add delta-matrix to sword's matrix every frame... if parenting would work as expected, i will need to add delta position only once, while parenting Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
macklebee Posted June 27, 2011 Share Posted June 27, 2011 I guess I am missing the issue here. I can parent a sword to the crawler's hand, then set the rotation and position as needed in the un-animated state. Then when I turn on the animation, the sword follows the hand automatically. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Pixel Perfect Posted June 27, 2011 Share Posted June 27, 2011 Same here. Just occationally in the past I have had issues with scaling where parenting a model to a particular parent model resulted in the parents scale being magnified many times. Never did figure that one out as it's perfectly ok with most I've tried. Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Flexman Posted June 27, 2011 Share Posted June 27, 2011 I had a parenting scale issue with a mesh entity (missiles on launch rails) and something interesting happened. When I used LoadMesh(...) for the missile objects they would scale oddly. I used LoadModel(...) on the same missile model and no scaling issue after parenting. I wondered if you guys might have come across this yourselves? @VeTal Quick question, where is the pivot/origin of that sword model? Quote 6600 2.4G / GTX 460 280.26 / 4GB Windows 7 Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT Tricubic Studios Ltd. ~ Combat Helo Link to comment Share on other sites More sharing options...
macklebee Posted June 27, 2011 Share Posted June 27, 2011 I had a parenting scale issue with a mesh entity (missiles on launch rails) and something interesting happened. When I used LoadMesh(...) for the missile objects they would scale oddly. I used LoadModel(...) on the same missile model and no scaling issue after parenting. I wondered if you guys might have come across this yourselves? @VeTal Quick question, where is the pivot/origin of that sword model? I havent tried the scaling issue but will see if i can reproduce it. Are you scaling the parent or the child meshes? Or is this just something odd that happens? The origin was in the middle of the blade, instead of at the middle of the handle. I changed the origin and orientation of the sword, parented it to the hand, positioned and rotated as needed, and ran the animations and it worked just fine. **Edit - If i set the parent of a model or a mesh, it will automatically take the scale of the parent. So if the parent is being scaled by .5, then the child model/mesh would have to scaled by 2 to keep it the original size. Scaling a child model/mesh has no effect of the parent. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Pixel Perfect Posted June 27, 2011 Share Posted June 27, 2011 Are you scaling the parent or the child meshes? Or is this just something odd that happens? Just something odd that happened. It was only with a few character models that I had. Whenever I parented a gun, which I had used with many other models successfully, to them then they (the parent character model) appeared in the render about 100 times the size they should be, absolutely massive! It just seemed to do weird things to the models scaling. As this was the minority not the majority I didn't bother investigating further, I just didn't use those models. Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
VeTaL Posted June 28, 2011 Author Share Posted June 28, 2011 2 Flexman: I used weapon from here http://www.leadwerks.com/werkspace/files/file/214-2-medieval-weapons/ macklebee is right: //The origin was in the middle of the blade, instead of at the middle of the handle. The main idea of delta-movement and delta-rotation was in correction.. but as you said that 1) I changed the origin and orientation of the sword, parented it to the hand, positioned and rotated as needed, and ran the animations and it worked just fine. 2) I guess I am missing the issue here. I can parent a sword to the crawler's hand, then set the rotation and position as needed in the un-animated state. Then when I turn on the animation, the sword follows the hand automatically. 3) If i set the parent of a model or a mesh, it will automatically take the scale of the parent. So if the parent is being scaled by .5, then the child model/mesh would have to scaled by 2 to keep it the original size. Scaling a child model/mesh has no effect of the parent. this is great information to sum up the most number of attaching questions. PS: but i'm missing nice-working Parenting, it should be more productive Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
macklebee Posted June 28, 2011 Share Posted June 28, 2011 parenting works decent for me so far for what i have tried. i suspect setting a sword to the crawler's hand would have been easier if the crawler had a tpose as the initial unanimated pose. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
VeTaL Posted June 28, 2011 Author Share Posted June 28, 2011 I'm talking about this ( http://www.leadwerks.com/werkspace/topic/3460-equipment-attaching/page__view__findpost__p__31510 ) Did you used EntityParent or SetEntityMatrix ? Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
macklebee Posted June 28, 2011 Share Posted June 28, 2011 that above is from parenting but since the crawler model's hand is already at a rotated angle, I had to position and rotate the sword just initially after I set the parent to make it look correct. Afterwards, just playing the animations made it follow the hand correctly. I moved the origin of the sword to the handle and changed the orientation so the blade is pointing up (mostly because it just made more sense for me to set the angle that way). medievalweapons_longsword.zip then i attached the sword by using this for the crawler script: require("scripts/class") local class=CreateClass(...) function class:CreateObject(model) local object=self.super:CreateObject(model) object.hand = object.model:FindChild("Bip01 R Hand") if object.hand~=nil then object.sword = LoadModel("abstract::medievalweapons_longsword.gmf",object.hand) object.sword:SetRotation(Vec3(230,-20,0)) object.sword:SetPosition(Vec3(.12,.05,-.05)) end end as for your video, i have no idea why that would happen... i have not had that issue. its almost like the bone hierarchy has been broken... did you by chance set the sword as the parent of the bone? dunno... weird. EDIT*** - uploaded the wrong sword... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
VeTaL Posted June 28, 2011 Author Share Posted June 28, 2011 I'll test, maybe if you attach to finger, there is nothing to break... and if sword is attached to Spine - all other hieracy is broken... i'll check your variant Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
macklebee Posted June 30, 2011 Share Posted June 30, 2011 as for your video, i have no idea why that would happen... i have not had that issue. its almost like the bone hierarchy has been broken... did you by chance set the sword as the parent of the bone? I'll test, maybe if you attach to finger, there is nothing to break... and if sword is attached to Spine - all other hieracy is broken... That is not true. I can set every bone in the model to have a sword attached to it and the animations work fine. You are breaking the bone hierarchy in your code which is why the animations do not work any more. TEntity sword = LoadModel ("medievalweapons_longsword.gmf"); EntityParent(FindChild(mi1->GetModel(),"Bip01 Spine"),sword,1); You are setting the sword as the parent to the spine. The proper syntax for EntityParent() is: void EntityParent( TEntity entity, TEntity parent, int global=1 ) as shown here: EntityParent() Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Roland Posted June 30, 2011 Share Posted June 30, 2011 Haha... That image really shows a figure that is well equipped for battle Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Pixel Perfect Posted June 30, 2011 Share Posted June 30, 2011 Agrees with Roland .... no way I'm taking that on Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
VeTaL Posted June 30, 2011 Author Share Posted June 30, 2011 EntityParent(sword,FindChild(mi1->GetModel(),"Bip01 R Finger0"),1); Really, this works nice.... such a stupid mistake Thanks, macklebee, for your time Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
macklebee Posted June 30, 2011 Share Posted June 30, 2011 eh, it happens... i totally missed it as well when i looked at the post the first time and apparently so did others... i just knew that parenting objects to the bones has worked for me in the past and i wanted to test to make sure something hadn't broken with any latest releases... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
VeTaL Posted June 30, 2011 Author Share Posted June 30, 2011 Okay, attaching model to bone is solved (sword, shield and so on), but what about attaching body armor/helmet? 1) About armor: looking like animator should create a speshial bone, which should indicate body rotation. i'm afraid that position of person's shoulder will differ from position of armor's shoulder. 2) About helmet (same for gloves and so on): as he is attaching on the head, the head is not visible (or hand in case with gloves). Wouldnt it be a waste of polygons? Or its better to create separate models and just cnahge "head" -> "helmet with face", "hand" -> "glove" ? Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
macklebee Posted June 30, 2011 Share Posted June 30, 2011 well it depends i guess on whether or not the gloves and helmet will be coming off alot... if they are going to be permanent then its probably easier just to make them part of the model to begin with... if say the helmet can get knocked off, then i would probably just live with the few extra polygons hidden by the helmet, especially since LE can handle large amounts of polys being rendered relatively well. Or you could do what alot of games do, and make the head a separate attachment. As for the armor, i think most games cheat when it comes to that by making the armor not interfere with any of the arms/shoulder animations... granted i am only guessing because i am far from being a character modeling expert. in any case, attaching a helmet to whatever bone controls the head's position/rotation should work just fine as long as you setup the helmet's initial position/rotation correctly for the un-animated pose just like i did for the sword. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.