Jump to content

Recommended Posts

Posted

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 ?

Stop toying and make games

Posted

Just add a bone to your model and call it (imaginatively) Hair ...

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"

Posted

Ok and what i do then in Lua ?

There is no code like :

This.entity.AttachToBone(targetModel, boneNAme)

 

Visual parenting should be some option.

Stop toying and make games

Posted

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.

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"

Posted

There is no code like :

This.entity.AttachToBone(targetModel, boneNAme)

 

Learn lua ... learn the Leadwerks API ... write a function ... simples.

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"

Posted

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 ?

Stop toying and make games

Posted

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?

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"

Posted

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 ?

Stop toying and make games

Posted

Anyway , have you some idea on what i try to do ?

 

Yes, I have lots of ideas.

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"

Posted

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

  • Upvote 1

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Posted

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.

Stop toying and make games

Posted

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.

  • Upvote 1
Posted

@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.

Stop toying and make games

Posted

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.

Posted

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.

Stop toying and make games

Posted

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

Stop toying and make games

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...