Wintermute Engine > Not a bug

Minor Bug: Actor's walk animation is reset when clicking at the same/another pos

(1/1)

ronin:
During evaluating version 1.8.8 (Beta) of the WME i made some tests with the actor movement/animation and tried some things a player probably never would do, but can do.
I noticed that if the player continuously clicks at the same position the actor's animation always restarts from beginning while walking to this position. This also happens if the player clicks on another position while the actor is already walking but does not change the direction.

The first problem can be dealt with for example by extending the "scene.script" like this

--- Code: WME Script ---#include "scripts\base.inc"actor.LastX = -1000; // an init value which is different from a valid position valueactor.LastY = -1000; // an init value which is different from a valid position value////////////////////////////////////////////////////////////////////////////////on "LeftClick"{    // when the scene is left-clicked, just send the actor to the specified point    // if the actor is not already walking to it.    if (actor.LastX != Scene.MouseX || actor.LastY != Scene.MouseY)    {        actor.LastX = Scene.MouseX;        actor.LastY = Scene.MouseY;        actor.GoTo(Scene.MouseX, Scene.MouseY);    }} 
The second problem can be weakend by defining a dead zone

--- Code: WME Script ---#include "scripts\base.inc"var diff;actor.LastX = -1000; // an init value which is different from a valid position valueactor.LastY = -1000; // an init value which is different from a valid position value////////////////////////////////////////////////////////////////////////////////on "LeftClick"{    // when the scene is left-clicked, just send the actor to the specified point    // if the actor is not already to a point near it.    diff.x = Math.Abs(actor.LastX - Scene.MouseX);    diff.y = Math.Abs(actor.LastY - Scene.MouseY);    if ( diff.x > 50 ||  diff.y > 20) // experimental values for the dead zone    {        actor.LastX = Scene.MouseX;        actor.LastY = Scene.MouseY;        actor.GoTo(Scene.MouseX, Scene.MouseY);    }} 
But this solution looks a bit dirty to me. Therefore it might be helpful if the engine itself could take care of these cases.

Mnemonic:
Just for the record, 3D actors already provide this feature (via actor.GoToTolerance property). 2D actors don't.

ronin:
It is good to know that this features is available for 3D characters.

But if i decide to use 2D character is there a better way to avoid or weaken this problem than the one i have posted before?

Is this feature planned for 2D characters in WME 1.X?

Mnemonic:
I think the "dead-zone" solution is ok (it's basically what the GoToTolerance does internally). Perhaps a more elegant solution would be to override the GoTo method instead of modifying the LeftClick handler.

IMO the first script is unnecessary though. The animation doesn't restart if you send the actor to exactly the same point.

ronin:
Alright. Thanks for your quick response. :)

Navigation

[0] Message Index

Go to full version