Moving Platform: Next Target every interact?

dwhamz

New member
Hey All,

I'm wondering if anyone has a quick solution for this.

Basically I want a door that opens and closes with a button press.

So basically I'm wondering with "Moving Platform" if there is a way to have the platform only move when interact is used? Instead of constantly moving on a loop.

Just figured I'd ask before I spend a lot of time programming a solution myself.

Thanks
 
The MovingPlatform component has the "Enable On Interact" parameter, which when enabled will only allow the platform to move after an interaction.
Sorry I guess I wasn't clear enough.

So I have a garage door set up with an interact button. But i want to open and close it every time I push it.

Right now when I interact with it. So I have it set to Target and the door will only move to the first waypoint. Is there a way to have it move to a different target every time I press interact? Example: interact once move to target 2. interact again move back to target 1.

Or should I just create my own script for this?

Just asking because I am a slow programmer so I didn't want to spend to much time on it if there is an easier alternative.
 
Ah I see what you mean now.

MovingPlatform doesn't quite do what you want out of the box - the "ping pong" movement type goes from A to B then straight back to A.

However I imagine it would be easy enough to tweak MovingPlatform to create this behaviour - you'd probably want to use the "target" movement type, and instead of calling GoToNextWaypoint() when it reaches its current target (in MovingPlatform.UpdateWaypoint), update the TargetWaypoint index (e.g. alternate between 1 and 0).
 
Ah I see what you mean now.

MovingPlatform doesn't quite do what you want out of the box - the "ping pong" movement type goes from A to B then straight back to A.

However I imagine it would be easy enough to tweak MovingPlatform to create this behaviour - you'd probably want to use the "target" movement type, and instead of calling GoToNextWaypoint() when it reaches its current target (in MovingPlatform.UpdateWaypoint), update the TargetWaypoint index (e.g. alternate between 1 and 0).
Thank you for the advice Andrew. I will give this a try!

I really appreciate the Opsive team always helping out!
 
@dwhamz I think I solved it, see this other post

I'm using BOLT visual scripting but you can easily decipher what I'm doing to put in to a C# script if need be, otherwise use BOLT, it's free in Unity now!

 
Top