The Tricky Platform


At some point in time I visualized a moving lift/platform in the design of the first area. Something akin to the kind found in classic Resident Evil games. I knew I had to have it, but I also knew it would not be easy to accomplish. But I went ahead and tackled it.

The first road block.

My first idea was to make the lift have physic properties, and once you threw a switch the physics would apply force, moving the lift toward the next platform. Then from there the player's position would be locked down to the XY of the lift  so that you moved with the platform. 

Obviously this would have made it too simple. Once I applied the physics behavior to the model inside of construct, my player was unable to move over top of the lift. This has to do with the Z space that the lift occupies. It did not matter how high I positioned my player's Z position, he would run into the space occupied by the lift and push it around. 

I brainstormed this problem for a little while before I decided I could not figure out a solution and knew that the lift could not be a solid object or have it's own physics behaviors. I would have to fake it. 

The solution.

What I managed to come up with was a great but tedious work around. I made an invisible platform that had a sine wave behavior (it hovered back and forth). Once it got to the lift on the other side of the dock, it would hit a trigger that set the lift's position to the XY of the invisible platform at every tick. So the lift would hover back and forth with the invisible platform.   Great, now I had my lift movement solved. Now I needed the lift to stop once it reached each dock, and start moving again once the player stepped inside of it. 


A maze of triggers. 

This is where things got tricky. In the end, and after many hours of problem solving, I came up with a system of eight triggers, that would turn on and off eight groups inside my event sheet.



Essentially it went like this. 

Invisible platform hits trigger 1 and the lift starts to move toward player at the other dock. 

Once the platform reaches the dock  it hits trigger 2, stopping the sine wave movement and the lift stays still. This activates the next group of triggers and turns off the previous set. 

The next issue.

I thought that I would be able to apply the same concept with the player's position as I did with the lift (setting the player's position to the XY of the invisible platform, having him move back and forth with the same sine wave) but that didn't work. Instead my player would launch into... I'm not sure where. I couldn't make out where he was in the map. 

I think this was because the player was a Q3DPoint object instead of a model. And it also had something to do with the way the camera was bound to the player. 

The solution.

I knew I could control the player's movement the same way that I do using the WASD on the keyboard. The player has physics behaviors and you can apply force to make the character move in a direction. 

So the player walks on to the platform, hitting trigger 3. This takes away the WASD movements first, so that you can't walk off the platform. You're locked in for the ride. Next, force is applied to the player so that it is moving toward the platform's XY at every tick. The amount of force applied determined if the player could keep up with the lift or not, this was tricky to get right and once I got it the player seemed to tremble a bit which added the unexpected effect of the lift shaking while moving. A surprising but welcomed accident. 

The player and the lift ride the invisible platform to the other dock. Once it hits the dock it strikes trigger 4, which stops the lift, turns off the group that applies force to the player, and reactivates the WASD movements. 

Another problem.

How would I make the lift re-usable? I didn't want this lift ride to be a point of no return for a player. There may be things they missed back on the other docks. But I knew implementing a multi use lift was going to be a lot more work. So I started the next phase.

More groups, more triggers.

Once you walk off the lift you hit trigger 5, activating trigger 6 on the platform. If you turn around and step onto the lift you hit trigger 6 and the process starts again. The sine wave is re activated and the player and the lift move towards the other dock, where it hits trigger 7, stopping the lift and activating trigger 8 on the dock. 

Aaaand, once you step off the dock and hit trigger 8, it resets everything back to the point where you are ready to step back on the lift, hitting trigger 3, and the process repeats. 

This was obviously a complex work around, and I'm not even sure if I am explaining what I did correctly. I was kind of in a feverish work/puzzle solving mode when I made it happen. 

But in the end I have my fully functional lift, and I have ridden it many many times. 

A success. 


Leave a comment

Log in with itch.io to leave a comment.