YouGroove Posted March 18, 2013 Share Posted March 18, 2013 I have some character, and i would want ot attach some different weapons in two hands by code. Caus it will be dynamic, you can equip and change weapons any time. Does someone already tried that ? I mean good positionning and orientation ? I 've done the model in Blender, perhaps it is some way to export weapons only but well placed in the scene? i mean export weapons without animations, only static models ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
cassius Posted March 18, 2013 Share Posted March 18, 2013 I have no expertize in this subject so I would just have two versions of the character,each with a different weapon. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
beo6 Posted March 18, 2013 Share Posted March 18, 2013 without having done this myself i would say you could have pivots on your character where the weapons should be positioned and the weapons should have some animations that are played the same time as the character animation. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 18, 2013 Author Share Posted March 18, 2013 Nope. Weapons are not animated to character specific animations. Search on any 3D engine forums or features : Weapons and stuff are attached to bones , so you can attach anything you made and that don't have animations. That's the way it's done on any 3D engine, and it's the best caus independant on character or it's animations. The other solutioon would be impossible. If i had 100 weapons, i would have 100 times the same models and animations exported ? i can't imagine the amount of work and space disk for the game ************* So yes, before going shadows, and eye candy stuff, LE3 engine should really provide essential functions to be able to make real games. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
beo6 Posted March 19, 2013 Share Posted March 19, 2013 Well. i looked at the Barbarian Model in DarknessAwaits and the Sword is actually its own Object attached to its right Hand. So i think this is already possible. Not sure how the model is exactly created though. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 19, 2013 Author Share Posted March 19, 2013 beo6 : Indeed if you just double click on barbarian you will see : IT's ONE MODEL ONLY : BARBARIAN + WEAPON. So indeed it's well placed and it's ONE WHOLE ANiMATED MODEL. There is not attaching function or whatever. I would like : "Eternal Light" game with a barbarian that could change weapons in game. really. LE3 instead of delivering some eye candy version, should make the actual lot more stable and finalized : 1) CORRECT SEVERE BUGS 2) TAKE ACCOUNT OF VERY NEEDED REQUESTS (camera gizmo, light gizmos , BSP requests etc ...) 3) ADD ESSENTIAL FUNCTIONS (bones and attaching functions for example) Quote Stop toying and make games Link to comment Share on other sites More sharing options...
cassius Posted March 19, 2013 Share Posted March 19, 2013 I can;t imagine anyone HAVING a 100 weapons,all different. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
tjheldna Posted March 19, 2013 Share Posted March 19, 2013 Hi YouGroove, I am in the process of migrating my inventory code and yes it appears to work so far. The way I line it up is have a dummy node linked to the players hand and a dummy node on the weapon which is used to set the position and transform. That way I can visually see how things line up. itemMountNode->SetParent(mountNode); itemMountNode->SetMatrix(mountNode->GetMatrix()); The weapons are sorted in a vector and iterated upon. As I'm switching weapons they are shown/hidden as necessary and always have a pointer to the current weapon. I'm writing this quickly before work, hope this helps. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 19, 2013 Author Share Posted March 19, 2013 Thanks. I tried but it failed. In Blender i put the character in edit mode (not pose) , than put the weapon on the good place in the hand, before exporting the weapon only. By code the weapon is loaded , than placed using Matrix, but it is in some strange place and not rotated well, but at least it follow the player. I'll go with fixed weapons shape and only texture variations i think. Or keep that part for later when someone will post some Lua solution (im' not a super programmer ) Quote Stop toying and make games Link to comment Share on other sites More sharing options...
dennis Posted March 19, 2013 Share Posted March 19, 2013 You can attach entity's to an specified point on the model right. If you give the model 2 pivots. On at the handle and the other at the fron (in case of gun / rifle) than you can attach it to the hand of any character Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 19, 2013 Author Share Posted March 19, 2013 do you have some code ? This is the matters here , not if you can do it. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
dennis Posted March 20, 2013 Share Posted March 20, 2013 I had a concept for it. But the answer is already given here. Will look it up when I return home. Working on my galaxy S3 isn't easy when searching up code and making code haha Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 20, 2013 Author Share Posted March 20, 2013 No worry, perhaps it's my way of placing weapon or bone that are not correct ? I'm still searching. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
dennis Posted March 20, 2013 Share Posted March 20, 2013 It isn't easy but I dreamed tonight and the answer came to my mind. I thought it was done becore with LE2 not sure though. But the diea is the same. I thought something like: setparent or entity. (Bone name):setparent Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 20, 2013 Author Share Posted March 20, 2013 I'll try thanks. Matrix functions seems to work , but not perfect. like i said , perhaps it's my weapon not correctly exported ? I put it at origin before export, perhaps rotation and other wan't good. It can be my models the problem not the code. But if anyone could have some Goblin with some simple weapon made of cubes working and the code, i will be happy to take it Quote Stop toying and make games Link to comment Share on other sites More sharing options...
dennis Posted March 20, 2013 Share Posted March 20, 2013 I have an working weapon for you! I attached it here: http://downloads.tbhproductions.com/yougroove.zip have fun Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 20, 2013 Author Share Posted March 20, 2013 Thanks a lot Dennis, but i wanted the code to attach a weapon in Lua. I already have weapons (your zip contains a weapon model, not some porject test with code to attach the weapon). Quote Stop toying and make games Link to comment Share on other sites More sharing options...
dennis Posted March 20, 2013 Share Posted March 20, 2013 You also were talking about that you are not sure that the weapons you used are exported correctly. but I will try to make some code for it Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 20, 2013 Author Share Posted March 20, 2013 Thanks. But if you have time, i'll do more tries myself, and i use LE3 and Lua. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
YouGroove Posted March 21, 2013 Author Share Posted March 21, 2013 Thanks for the help. Here is another way that seems to work : (the weapon is loaded in App.lua for the test) -- Get the bone by name of the hand of the character to attach the weapon local child = self.entity:FindChild("Bone.009") --Get matrix of the bone [size=4] mat = child:GetMatrix();[/size] [size=4]--Apply matrix to the weapon[/size] App.weapon:SetMatrix(mat) I'll have to figure out how to export weapon to kep it well placed in the character hand. Or the other way is to give some offsets values to position the weapon after Matrix placement. Quote Stop toying and make games 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.