Character Position on Scene Start

I have two characters I’ve added to my scene. I’ve placed them in to different positions on the ground plane (using “Basic Physics” example scene from Needle). They each have capsule collider and animator components. However, when I export them, in the WebXR scene they’re both at the origin (0,0,0). Even when I set their position in TypeScript in start() like I usually do in Unity or in awake(), they still don’t go to the global position I specify with
this.gameObject.position.setX(1);
this.gameObject.position.setZ(0);

However, if I put the same TypeScript code in update() in the same script it works.

Primitive gameObjects already in the “Basic Physics” scene start where placed in the scene view window.

Any reason for this behavior that you can think of? Should I put the position update code in another Lifecycle method?

Original Post on Discord

by user 581381221087445033

I’m using the needle-engine-samples repo.

by user 581381221087445033

Hi @Darius Clarke does the animator animate their position?

Hi @marcel :cactus: I’m not sure. I’m using this asset from the Unity Asset Store:

Here’s a free version of one of their characters in case you wanted to test it with the Needle Engine Exporter:

As you can imagine, this would be useful in a teaching environment with teenagers. It exports and animates in the resulting local web distro. It’s just the positioning that’s off.

by user 581381221087445033

Can you put each character in an empty gameobject and move the empty gameobject instead for testing?

I’ll try that.

by user 581381221087445033

That worked. Thanks for the tip.

by user 581381221087445033

You can mark answered and the archive this message.

by user 581381221087445033