Moving Platform: Know when it's moving?

Pat

New member
Hi,

Is there a way to know when a MovingPlatform is actually moving? Would be quite helpful.

At the moment I'm checking if the MovementType is not Target (it's always moving in that case) or if GetRemainingDistance() > 0.01f:

C#:
    public bool IsMoving
    {
        get
        {
            if (m_MovementType != PathMovementType.Target)
                return true;

            if (GetRemainingDistance() > 0.01f)
                return true;

            return false;
        }
    }

I had to modify the MovingPlatform source file though, which I'd like to avoid because I'll have to do my changes again when I update.

Is there any more elegant way or would it be possible to include the property or something similar in one of the next releases?

Thanks!
Best regards,
Pat
 
That property looks good. I recommend subclassing MovingPlatform so it makes updating easier and then adding that property. GetRemainingDistance is currently private but I have made it protected in the next version.
 
Is there a way to know when a MovingPlatform is actually moving? Would be quite helpful.

Out of curiosity @Pat, what are you intending to do with this knowledge? I can think of a few things myself, but I'm curious what your intended application is.

On a semi-related note, @Justin is there a built-in way to know what the MovingPlatform object's position and rotation will be at a given point in time? I don't want to reinvent the wheel if it already exists.
 
I have a level segment where a bunch of platforms out of a larger group of platforms are triggered at random. For now I only want to trigger those who are not yet moving already.
For a visual clue, take a look at Star Wars Rebels episode 6:
 
I have a level segment where a bunch of platforms out of a larger group of platforms are triggered at random. For now I only want to trigger those who are not yet moving already.
For a visual clue, take a look at Star Wars Rebels episode 6:

Cool, thanks for the share.
 
Top