What if your game relies on user supplied model files, that are not included in the distribution?
If a file is not located in the default location (e.g. assets directory), you can register a
custom Locator and load it from any path.
Here is a usage example of a ZipLocator that is registered to a file town.zip in the top level of
your project directory:
assetManager.registerLocator("town.zip", ZipLocator.class);
Spatial scene = assetManager.loadModel("main.scene");
rootNode.attachChild(scene);
When I tried this it didnt seem correct.
I had to add
scene.setLocalTranslation(0.0f, -5.0f, 0.0f);
to get the ninja âstandingâ on the ground (rather than it bisecting him through the waist)
Here is a usage example of a ZipLocator that is registered to a file town.zip in the top level of your project directory:
Literally every example in the tutorial translate the scene or the model. This specific snippet shows how to use the ZipLocator. Translation info is not necessary info for this particular example.
You guys need to get ur story straight, the first person says it works just fine, which results in image_1 posted above, clearly incorrect.
The second person says you are not supposed to run the code at that point because 1/2 a page of reading later the additional REQUIRED code can be found, which adds the translation and sets the scale to 2 (the extra code is found later) if the code is not supposed to be run at that point then it shouldnât be attached.
Person 3 says, ur supposed to transect the ninja through the waist and i just dont understand when ground is not below the feet the added objects
to make the code work, because clearly translations are tooo difficult for me
you know, nvm,
no more posting bugs/problems from me to help with an open source project
after all, a code snippet in a TUTORIAL that draws ground through the middle of the model thats supposed to be standing on it is perfectly fine and its my problem that i cant grasp ground at waist level
so far iâm impressed with ur engine and i intend to use it, its still got rough edges but thats to be expected.
at least i now know not to post any code improvements i make because nobody is open to alteration/modification, will speed things up drastically
iâm too stupid to understand translations, and shouldnât be doing this tutorial
-or-
the tutorial tells u what to do
you cant have it both ways !!!
its simple, by attaching to rootNode, you are âpublishingâ the town model
either dont publish it at that point in the tutorial (remove the attachChild() ) because that is only an explanation of a concept and should not be run
-or-
add the translation to the code snippet because without it the code doesnt make sense
Its been a while since I looked at the tutorials but judging by the url this specific tutorial is about loading assets.
Now, am I allowed to ask what changing the position of an object has to do with loading assets?
Also, either the tutorial already explained how to change the position of an object. In which case it shouldnât have to tell you how to do that again in order to put the ninja in the correct spot. OR the tutorial did not cover that in which case it should NOT add the code as its irrelevant and may confuse readers (as it deals with something they havenât used before)
In the first case an side note also shouldnât be nesesary as when you read the code you should see what is missing. In the second case a side note would indeed be preferred though not containing the code that âfixesâ it but rather a warning that this will happen and that the way to fix this will be touched on later.