@Override protected void onLoaded () { if (currentlyLoading == null || currentlyLoading.isEmpty()) return; instances.clear(); animationControllers.clear(); final ModelInstance instance = new ModelInstance(assets.get(currentlyLoading, Model.class)); for (Material m : instance.materials) m.set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, 0.8f)); instances.add(instance); if (instance.animations.size > 0) animationControllers.put(instance, new AnimationController(instance)); currentlyLoading = null; }
@Override protected void onLoaded () { if (currentlyLoading == null || currentlyLoading.length() == 0) return; instances.clear(); animationControllers.clear(); final ModelInstance instance = new ModelInstance(assets.get(currentlyLoading, Model.class)); instance.transform = transform; instances.add(instance); if (instance.animations.size > 0) animationControllers.put(instance, new AnimationController(instance)); currentlyLoading = null; instance.calculateBoundingBox(bounds); cam.position.set(1, 1, 1).nor().scl(bounds.getDimensions(tmpV1).len() * 0.75f + bounds.getCenter(tmpV2).len()); cam.up.set(0, 1, 0); cam.lookAt(0, 0, 0); cam.far = 50f + bounds.getDimensions(tmpV1).len() * 2.0f; cam.update(); }
final ModelInstance instance = new ModelInstance(assets.get(currentModel, Model.class), transform); instances.add(instance); if (instance.animations.size > 0) animationControllers.put(instance, new AnimationController(instance));
character.transform.setToRotation(Vector3.Y, 180).trn(0, -bbox.min.y, 0); instances.add(character); animation = new AnimationController(character); animation.animate("Idle", -1, 1f, null, 0.2f); status = idle;
private void retrieveSource(String source) { ModelCacheEntry entry = (ModelCacheEntry) sourceCache.get(source); if (entry == null || entry.refCounter < 1) { loadSource(source); EngineAssetManager.getInstance().finishLoading(); entry = (ModelCacheEntry) sourceCache.get(source); } if (entry.modelInstance == null) { Model model3d = EngineAssetManager.getInstance().getModel3D(source); entry.modelInstance = new ModelInstance(model3d); entry.controller = new AnimationController(entry.modelInstance); entry.camera3d = getCamera(entry.modelInstance); } }
animations = new AnimationController(modelInstance);
public DogCharacter(Model model, String name, Vector3 location, Vector3 rotation, Vector3 scale, btCollisionShape shape, float mass, short belongsToFlag, short collidesWithFlag, boolean callback, boolean noDeactivate) { super(model, name, location, rotation, scale, shape, mass, belongsToFlag, collidesWithFlag, callback, noDeactivate, new DogSteerSettings()); // Create behavior tree through the library BehaviorTreeLibraryManager btlm = BehaviorTreeLibraryManager.getInstance(); this.tree = btlm.createBehaviorTree("btrees/dog.btree", this); // Create animation controller animations = new AnimationController(modelInstance); // Create path follower followPathSteerer = new FollowPathSteerer(this); // Create wander steerer wanderSteerer = new WanderSteerer(this); // Init flags humanWantToPlay = false; stickThrown = false; alreadyCriedForHumanDeath = false; humanIsDead = false; }