eldinor / yuka-babylonjs-ts-starter

Yuka Game AI + Babylon.js Typescript Starter
MIT License
13 stars 2 forks source link

A clarification: YUKA parenting #2

Closed arcman7 closed 1 year ago

arcman7 commented 1 year ago

try to avoid parented TransformNodes with YUKA. YUKA will place your object in world space. Use YUKA's parenting instead.

What YUKA parenting system are you referring to? I searched through the code at https://github.com/Mugen87/yuka and I couldn't find any references to a parenting system other than that used with the Node class, unrelated to any sort of positioning system.

RolandCsibrei commented 1 year ago

Parenting GameEntity objects as seen here for example:

https://github.com/eldinor/yuka-babylonjs-examples/blob/f8d9f36fe181dc5f3ef4c2746dbe39ea8d884e37/examples/js/playground/hideAndSeek/src/Player.js#L28

arcman7 commented 1 year ago

Oh nice! Thanks for the quick reply!

   this.headContainer = new GameEntity()
    this.add(this.headContainer)

So this actually affects the positioning of child entities; positioning the parent and rotating the parent affects the children entities position and rotation attributes in world space?

RolandCsibrei commented 1 year ago

You're welcome! Yes, it definitely should behave like parenting in BJS.

On Tue, Jan 10, 2023, 6:39 AM Andrew Ryan Carpenter < @.***> wrote:

Oh nice! Thanks for the quick reply!

this.headContainer = new GameEntity() this.add(this.headContainer)

So this actually affects the positioning of child entities; positioning the parent and rotating the parent affects the children entities position and rotation attributes in world space?

— Reply to this email directly, view it on GitHub https://github.com/eldinor/yuka-babylonjs-ts-starter/issues/2#issuecomment-1376760832, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYKGHOIA5IKFBF2B3ENKRDWRTY2HANCNFSM6AAAAAATV7XNWA . You are receiving this because you commented.Message ID: @.***>