com.badlogic.gdx.graphics.g3d.utils.AnimationController Java Examples

The following examples show how to use com.badlogic.gdx.graphics.g3d.utils.AnimationController. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Sprite3DRenderer.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
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);
	}
}
 
Example #2
Source File: AnimationsPlayer.java    From gdx-gltf with Apache License 2.0 5 votes vote down vote up
public void update(float delta){
	if(controllers.size > 0){
		for(AnimationController controller : controllers){
			controller.update(delta);
		}
		scene.modelInstance.calculateTransforms();
	}else{
		if(scene.animationController != null){
			scene.animationController.update(delta);
		}
	}
}
 
Example #3
Source File: DogCharacter.java    From GdxDemo3D with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #4
Source File: HumanCharacter.java    From GdxDemo3D with Apache License 2.0 5 votes vote down vote up
public HumanCharacter(Model model,
					  String name,
					  Vector3 location,
					  Vector3 rotation,
					  Vector3 scale,
					  btCollisionShape shape,
					  float mass,
					  short belongsToFlag,
					  short collidesWithFlag,
					  boolean callback,
					  boolean noDeactivate,
					  Array<BlenderEmpty> ragdollEmpties,
					  String armatureNodeId) {

	super(model, name, location, rotation, scale,
			shape, mass, belongsToFlag, collidesWithFlag,
			callback, noDeactivate, ragdollEmpties, armatureNodeId,
			new HumanSteerSettings());

	// Create path follower
	followPathSteerer = new FollowPathSteerer(this);

	// Create the animation controllers
	animations = new AnimationController(modelInstance);
	// Create animation listeners for states that need one
	stateAnimationListeners = new EnumMap<HumanState, AnimationListener>(HumanState.class);
	stateAnimationListeners.put(HumanState.THROW, new AnimationListener());

	// Create the state machine
	stateMachine = new DefaultStateMachine<HumanCharacter, HumanState>(this);
	// Set the steering variables associated with default move state (walking)
	stateMachine.changeState(moveState);
	// Then make the character idle
	stateMachine.changeState(moveState.idleState);
}
 
Example #5
Source File: Sprite3DRenderer.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
@Override
public void onEnd(com.badlogic.gdx.graphics.g3d.utils.AnimationController.AnimationDesc animation) {
	if (animationCb != null) {
		ActionCallback tmpcb = animationCb;
		animationCb = null;
		tmpcb.resume();
	}
}
 
Example #6
Source File: Actor3d.java    From Scene3d with Apache License 2.0 5 votes vote down vote up
public Actor3d(Model model, float x, float y, float z){
	super(model);
	setPosition(x,y,z);
	//boundBox = model.meshes.get(0).calculateBoundingBox();
	calculateBoundingBox(boundBox);
       center.set(boundBox.getCenter());
       dimensions.set(boundBox.getDimensions());
	radius = dimensions.len() / 2f;
	animation = new AnimationController(this);
}
 
Example #7
Source File: AnimationListener.java    From GdxDemo3D with Apache License 2.0 4 votes vote down vote up
@Override
public void onEnd(AnimationController.AnimationDesc animation) {
	animationCompleted = true;
}
 
Example #8
Source File: AnimationListener.java    From GdxDemo3D with Apache License 2.0 4 votes vote down vote up
@Override
public void onLoop(AnimationController.AnimationDesc animation) {
}
 
Example #9
Source File: Sprite3DRenderer.java    From bladecoder-adventure-engine with Apache License 2.0 4 votes vote down vote up
@Override
public void onLoop(com.badlogic.gdx.graphics.g3d.utils.AnimationController.AnimationDesc animation) {
}
 
Example #10
Source File: Actor3d.java    From Scene3d with Apache License 2.0 4 votes vote down vote up
public AnimationController getAnimation(){
	return animation;
}