Custom anchor definitions for in-engine use?

Discuss issues pertaining to the Creature Animation Editor here.
Post Reply
pg_interactive
Posts: 25
Joined: Thu Feb 22, 2018 2:42 pm

Custom anchor definitions for in-engine use?

Post by pg_interactive » Thu Mar 15, 2018 12:36 pm

Hi,

We have an in-house particle generator generating flame to be attached to a torch which is an item that is animated/(attached to character) using creature. The flame particle generator needs to handle the flame within the engine, we dont want to animate the flame manually within creature. How can we accomplish this (eg how to get handle of the changing position of the torches tip within the engine so we can update the position of the particle emitter of our particle generator)?

Are there some anchors we can set on to the tip of the torch in Creature perhaps?

chong
Posts: 1178
Joined: Thu Feb 19, 2015 2:21 am

Re: Custom anchor definitions for in-engine use?

Post by chong » Thu Mar 15, 2018 3:41 pm

Hello,

Yes so depending on the runtime you are using ( UE4, Unity etc. ), you can get the position of a bone easily if you know the name of it.
In UE4 for instance, there is:
GetBluePrintBoneXform() which will return you the bone's transform given its name. This is precisely used for particle attachments.

In Unity, the docs write: ( https://www.kestrelmoon.com/creaturedoc ... times.html )
" Retrieving Bone Positions Easily ( For attachments etc. )
You can easily retrieve bone positions of your character via the following methods in the GameController:
GetBoneStartPt(string bone_name) Returns the bone's start position in world space
GetBoneEndPt(string bone_name) Returns the bone's end position in world space "

In general, all creature runtimes follow the same pattern. You can retrieve bone positions after the animation timestep via this:

Code: Select all

var bones_map = target_creature.render_composition.getBonesMap();

You loop through each bone:

foreach (var cur_bone_packet in bones_map)
{
  var set_start_pt = cur_cur_bone_packet.Value.GetWorldStartPt();
  var set_end_pt = cur_bone_packet.Value.GetWorldEndPt();

  // Now start and end pts are in local character space, make sure you transform them into world space for your attachments!
}
You need to remember to transform the bone positions into world space, this will depend on what engine you use and how that engine does character to world space transformations. You can look at the code for UE4 or Unity for reference.

Cheers

pg_interactive
Posts: 25
Joined: Thu Feb 22, 2018 2:42 pm

Re: Custom anchor definitions for in-engine use?

Post by pg_interactive » Thu Mar 15, 2018 4:03 pm

Thank you, this sounds like an okay solution.

However it might be better to have a feature, where you could add "points" to meshes, like your "anchor points", which would avoid the need to calculate custom "points" relative to "bone" position and rotation. In the above-mentioned example, imagine that the torch does not actually have a bone, only the hand holding it. Neither does a sword or different types of items we might want to "swap in", which in turn means we need to have engine-side all the possible combinations of "point offsets" and recalculate them based on position and rotation of the target bone (using line intersection or similar). Or use multiple "Extra" bones for each item requiring an extra "point definition".

Dont know if that makes any sense. I will proceed with the bone solution you've offered, i can work with it.

chong
Posts: 1178
Joined: Thu Feb 19, 2015 2:21 am

Re: Custom anchor definitions for in-engine use?

Post by chong » Thu Mar 15, 2018 5:33 pm

Hello,

Actually that makes a lot of sense! I will look into letting you author vertex attachments for an upcoming update. At the very least, it will write out the attachment vertex index into the metadata JSON so you can parse and read it in and use it for your custom attachment needs.

Cheers

pg_interactive
Posts: 25
Joined: Thu Feb 22, 2018 2:42 pm

Re: Custom anchor definitions for in-engine use?

Post by pg_interactive » Thu Mar 15, 2018 8:20 pm

Super awesome!!!

chong
Posts: 1178
Joined: Thu Feb 19, 2015 2:21 am

Re: Custom anchor definitions for in-engine use?

Post by chong » Fri Mar 16, 2018 4:57 am

Hello,

Vertex Mesh Attachments is already mostly working:

Image

The yellow points are the points on the mesh and the red point is the selected vertex point attachment.

This should be in for the next Creature update. Also, the UE4 runtimes already got updated:
https://github.com/kestrelm/Creature_UE4

Will be working on updating Unity next.

The Windows update will be rolled out first, then Mac after that.

Thanks

chong
Posts: 1178
Joined: Thu Feb 19, 2015 2:21 am

Re: Custom anchor definitions for in-engine use?

Post by chong » Fri Mar 16, 2018 5:42 pm

Unity runtimes also just got updated for Vertex attachments:
https://github.com/kestrelm/Creature_Unity

Cheers

Post Reply