nnpa
March 3, 2023, 6:30am
51
conver all (2) models to j3o and add lod
Node sceneNode = (Node)rootNode.getChild("Plane");
Geometry sceneGeometry = (Geometry)sceneNode.getChild(0);
LodGenerator lod = new LodGenerator(sceneGeometry);
lod.bakeLods(LodGenerator.TriangleReductionMethod.PROPORTIONAL,0.25f, 0.5f, 0.75f);
LodControl lc = new LodControl();
sceneGeometry.addControl(lc);
nnpa
March 3, 2023, 7:36am
52
the game is ready, but Iām not sure that it will not work on a mobile phone
tried to use low poly models
waiting for a solution to the problem
opened 06:22PM - 02 Mar 23 UTC
Android
I create project from hello piking tutorial
```
createNPC(50,0,50);
rootNo⦠de.attachChild(shootables);
```
```
private void createNPC(float x,float y,float z) {
Spatial model = assetManager.loadModel("assets/Models/test.glb");
String id = getRandomString();
model.setName( id);
SphereCollisionShape sphereShape = new SphereCollisionShape(2.0f);
CharacterControl myThing_phys = new CharacterControl( sphereShape , 1.2f );
model.addControl(myThing_phys);
bulletAppState.getPhysicsSpace().add(model);
model.addControl(new EnemyControl(this));
myThing_phys.setPhysicsLocation(new Vector3f(x,y,z));
shootables.attachChild(model);
}
```
```
public void shoot(){
if(nextShoot< Instant.now().getEpochSecond()){
if(cartridges > 0){
cartridges = cartridges - 3;
shootSound.play();
CollisionResults results = new CollisionResults();
Ray ray = new Ray(cam.getLocation(), cam.getDirection());
shootables.collideWith(ray, results);
if (results.size() > 0){
Vector3f pt = results.getCollision(0).getContactPoint();
Spatial npcSpatial = (Spatial)results.getCollision(0).getGeometry().getParent().getParent().getParent();
EnemyControl npcControl = npcSpatial.getControl(EnemyControl.class);
if(npcControl != null){
npcControl.shuted();
}
}
nextShoot = Instant.now().getEpochSecond() + 1;
}else{
clickSound.play();
}
}
}
```
working on desktop
https://www.youtube.com/watch?v=zbRblVPeua0
npc die after 3 piking
and not working on android
only works from a short distance
project https://disk.yandex.ru/d/TsnxnyYbahBnrw
not sure what is done, but for sure you have missing Light probes to render PBR models properly.
Also picking models randomly, will never give nice result. Too much different styles.
Not to mention to use some filters or something to look it better too. But since it must be Mobile game, then idk.
1 Like
nnpa
March 3, 2023, 11:57pm
54
how to add Light probes?
in blender?
in game.
its same in blender the fortest ball in bottom-right of your screenshot.
you can use either LightProbeFactory to generate one from your game environment or load some existing ones(like blender load forest one)
You can watch this for example to understand (you can do everything via Code ofc):
Use mixamo.com + Blender to use some pre-made models & animations. No programming skills needed:
3 Likes
For some reason it amuses me you called her Tiffany
1 Like
Pavl_G
March 18, 2023, 12:02am
58
Cool! Keep up, make sure to remove those logs once you are on an alpha production or use only debug logs. Good Luck!