YouGroove Posted August 2, 2013 Share Posted August 2, 2013 I have a character object and some hair object. I want visually place a pivot in the character model: i must make a prefab containing character and pivot ? Now how to say place the hair object at pivot always ? Make it child of parent pivot object ? Can it be done visually , it's possible in Unity and other engine to do such stuff visually (i can give a youtube link) Must i use some script and target , than drag hair object on the target slot of player script ? Something like that is possible ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Marleys Ghost Posted August 2, 2013 Share Posted August 2, 2013 Just add a bone to your model and call it (imaginatively) Hair ... Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
YouGroove Posted August 2, 2013 Author Share Posted August 2, 2013 Ok and what i do then in Lua ? There is no code like : This.entity.AttachToBone(targetModel, boneNAme) Visual parenting should be some option. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Marleys Ghost Posted August 2, 2013 Share Posted August 2, 2013 Ok and what i do then in Lua ? You look for the bone called hair .. then hang your hair on it ... kind of self explanatory really. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Marleys Ghost Posted August 2, 2013 Share Posted August 2, 2013 There is no code like : This.entity.AttachToBone(targetModel, boneNAme) Learn lua ... learn the Leadwerks API ... write a function ... simples. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
YouGroove Posted August 2, 2013 Author Share Posted August 2, 2013 Im' not core programmer, and i don't understand math vectors a lot. Some other engines have such hight level functions for you ready to use to make easy stuff on characters or vehicles etc ... Any function ideas so in Lua ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Marleys Ghost Posted August 2, 2013 Share Posted August 2, 2013 Im' not core programmer, and i don't understand math vectors a lot. You don't have to worry about vectors but if you won't spend time learning lua ... and learning the Leadwerks API how do you expect to accomplish anything using an engine that requires programming? Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
YouGroove Posted August 2, 2013 Author Share Posted August 2, 2013 I'm in already. I don't remember what means extra, self calls in script (We should really have clear tutorial on how it works) Anyway , have you some idea on what i try to do ? Visually place a pivot ? Have a target variable named "hair" in player.lua In the editor darg and drop hair object in script target slot. The code would attach that hair object to the player head bone. How to ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Marleys Ghost Posted August 2, 2013 Share Posted August 2, 2013 Anyway , have you some idea on what i try to do ? Yes, I have lots of ideas. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
shadmar Posted August 2, 2013 Share Posted August 2, 2013 maybe something like this : self.child = self.entity:FindChild("hair") -- this is a bone called hair on your human mesh, you need to name it hair from your modeler. if self.child then hairmesh:SetMatrix(self.child:GetMatrix()) end 1 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
YouGroove Posted August 2, 2013 Author Share Posted August 2, 2013 Thanks shadmar. So what i have to do is place character and the separate hair mesh in same prefab , or load the hair mesh by code in player.lua instead. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted August 2, 2013 Share Posted August 2, 2013 Can't you just make it a child in the editor, position it where you want it via the editor, save as prefab and now you're good to go. This is what I did with my moles. No coding required, and nice and easy. 1 Quote Link to comment Share on other sites More sharing options...
YouGroove Posted August 2, 2013 Author Share Posted August 2, 2013 @Rick : That's great for simple follow object, like a feary or other stuff. But beacuse it's for hair, if the head of character turns, the hair must rotate and have same orientation along all axis, that's why i think i need ot do like said before and use a bone and some matrix function. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted August 2, 2013 Share Posted August 2, 2013 My clown mole has a big afro and when you hit him he spins on the way down and the hair moves with it. The entire model hierarchy should be visible in the scene tab. Make the hair the child of the head node. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted August 2, 2013 Author Share Posted August 2, 2013 Thanks a lot Rick. So easy to do it visually, i didn't understood we oculd go in hierarchy bones in Scene editor. This attaching tips should be in some WIKI or sticked somewhere. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
YouGroove Posted August 3, 2013 Author Share Posted August 3, 2013 It can be done by code also. SetMatrix will apply scaling also. As the hair must just be placed and rotated here is how it works not visually but by code : Script:UpdatePhysics() ... local childBone = self.entity:FindChild("Bone_004") if childBone~= nil then hairObject:SetPosition(childBone:GetPosition()) hairObject:SetRotation(childBone:GetRotation()) end 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.