question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tweening In Entitas

See original GitHub issue

In my EntitasCoverShooter project I tween position of some Entities. NOTE: This project is still incomplete as of August 13, 2016.

When I process the entities which have a PositionComponent, I check a custom useTween property. The result is good. Entities can tween or not tween the position and the system respects it. This solution was inspired by another Entitas sample project. I forget which one 😃 For now, I do all tweens at the same duration of 0.3f, but of course that could be stored in the component too.

As a side note, outside the scope of this post…

  • I use the 3rdParty HOTween. I like it 😃
  • I use UnityEngineReplacementUtility as an an experimental approach to include NO UnityEngine namespace types in my Entitas Components and Systems. Its working well so far. I mention it since its included in the snippet below, but not to generate discussion on it.
  • My personal approach to Entias is to store data in Components, the process data in Systems, and to update GameObjects only in Controllers. The example below follows that convention.

In the ViewController.cs I do this;

if (!entity.position.useTween)
{
    ((GameObject)entity.view.gameObject).transform.position = UnityEngineReplacementUtility.Convert(entity.position.position);

}
else
{
    ((GameObject)entity.view.gameObject).transform.DOMove(UnityEngineReplacementUtility.Convert(entity.position.position), 0.3f);
}

Questions

  1. What alternative approaches can there be to handle games with entities that sometimes tween and sometimes do not tween?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aqaddoumicommented, Nov 8, 2016

Okay, thanks for the answer, I will see how I will go about it and keep you guys updated 😃

0reactions
mzakscommented, Nov 8, 2016

I would say it is a question of flexibility. By providing abstractions and hiding the state you can implement a very clean way of using the system. However it will push user into certain way of solving the problem. By exposing the state as components you can enable things like complex animation morphing. The developer who knows the animation of the game can write custom systems which can evaluate current animation state and decide how to proceed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tweening In Entitas · Issue #145
When I process the entities which have a PositionComponent , I check a custom useTween property. The result is good. Entities can tween...
Read more >
Did you ever embrace ECS? When did it click for you?
For my hobby project, a Secret of Mana style ARPG, using Entitas' ECS has made it a lot easier to manage by breaking...
Read more >
CorundumGames.Codegen 0.1.3
Tweening.Plugins.Options; using Entitas; using UnityEngine; // This component is hand-written [Game] public sealed class ...
Read more >
C# (CSharp) Entitas Entity.RemoveTween Examples
These are the top rated real world C# (CSharp) examples of Entitas.Entity.RemoveTween extracted from open source projects. You can rate examples to help...
Read more >
ECS or Why Should I Bother Making My Game Efficient
Entitas is just a recall to your topic, go full or hybrid. ... I'm looking at 4ms in costs from running tweens on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found