Jump to content

Visually Parenting or Pivot ? For Lua use


YouGroove
 Share

Recommended Posts

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

Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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

Link to comment
Share on other sites

@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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...