iso74
November 20, 2022, 9:45pm
#1
Hi,
just wondering how it would be possible to create a player template / entity for 3rd person controller
programmatically?
To achieve e.g. something like this: Third Person Controller - PLAYCANVAS
Or is it possible to export such template from the Editor?
yaustar
November 21, 2022, 10:45am
#2
This is a bit tricky as Templates weren’t really designed for engine only use.
Template assets are JSON files under the hood and share similar (if not the same) format as scenes which means they are referencing after assets by asset id etc.
There’s thread on creating and editing templates at runtime but this is not a supported usecase: Create & Edit Templates at Runtime
You can get the template asset data from an Editor project in a roundabout way.
On the template asset, disable ‘preload’ and download a build of the project.
The template asset will be in a separate JSON file under a separate assets folder.
iso74
November 21, 2022, 12:42pm
#3
Hmm, I see, well in this case I might be easier to programmatically create the player entity. Is there an example to start with?
There are many engine only examples here: PlayCanvas Examples
1 Like
yaustar
November 21, 2022, 1:19pm
#5
1 Like
iso74
November 21, 2022, 2:21pm
#6
I should even better read the docs, thanks guys!