Menu

Programming Rowing Physics for VR in Unity

If you’ve ever used a kayak or a canoe before, you probably know how interesting the interaction between the paddle or oar, the boat, and the water can be. Initially, it may not be super intuitive, perhaps a bit clumsy, and after a while once you get the hang of it, it feels wonderful to be moving in this way.

When Mantis Games approached us back in 2016 to work on a prototype and technical proof of concept to replicate this feeling for the paddling mechanics for their VR game Journey For Elysium, we took on the challenge.

Paddle along through our prototype as we talk about everything that goes into lifelike boat and paddle physics.

In this article, we will be sharing what these Forbes-best-VR-games-of-2019 winning mechanics involved on a more technical level.

Not a so much a technical geek, or just looking for additional information about the project? Check out our other articles about this project.

Applying Forces to the Boat

To get to a lifelike paddling experience, we made the oar and the shape of the boat the deciding factors of your movement in the prototype. We gave the oar a script that interacts with the boat’s script. It determines the forces that are applied to the boat, impacting how it moves through the water.

Both the oar and the boat are set up as Rigidbodies in Unity, which means that their position and movement are affected by forces known to Unity’s built-in physics engine, NVIDIA PhysX.

By leveraging the physics engine, we reduce the problem to calculating the forces related to how the oar and boat interact with the water, and can leave the actual movement that results from these forces to the physcis engine.

Rowing

The waterflow will apply a certain force on the boat, making it accelerate frame after frame.

For example when you’re paddling through some rapids, we will be continuously applying a force to the boat aligned with the direction of these rapids, making the boat accelerate frame after frame. Also, when your boat is floating into a bend in the river, we are applying forces to keep the boat away from the sides to make it easier for the player to maneuver past this obstacle while avoiding getting stuck.

An important element in the movement of the boat is to also apply the right amount of drag, and to have this be dependent on the direction in which the boat moves: if the boat is moving sideways, you’d want a lot more drag to be applied than when you’re moving foward or backwards. If you’re paddling to make the boat go forward, you’re supposed to feel a lot less resistance compared to when you’re trying to move it sideways. This requires us to ignore Unity’s built-in controls for drag, and calculate the drag force ourselves depending on the direction of the velocity vector of the boat compared to the direction of the boat tiself. The drag in our prototype is about 50% higher when you’re trying to move left or right, compared to when you’re moving forward.

Making the Oar VR Proof

As our client was conducting playtests on the first iteration of the prototype, we received reports that certain players were getting confused by the movement of the boat: sometimes when they expected it to move forward, it moved backwards, and the other way around. Unbenownst to them, they were were actually keeping the oar submerged while moving it back and forth, as they weren’t encessarily looking in the direction of the oar at all times.

In order to address this, we added haptic feedback when holding the oar in the water, making the VR controllers vibrate. This is important because otherwise you wouldn’t know when the oar is actually in the water and you’d have to guess whether you’re actually paddling instead of just stirring the water.

rubber banding effect

We have applied a rubber banding effect to the hands, for a more fluid experience.

While in VR, you typically want to represent the position of your hands where they actually are in the real world. However, when holding an oar, you woudn’t be able to just hold it any way you please; after all, for a plausible paddling experience, the oar’s movement would need to be constrained by its surroundings.

In order to allow both, we loosely attached the oar to the hands, using a rubber banding effect – so that the paddle stops moving when it is pushed into a wall, while the hands can continue their movement. If the hands and the oar move too far way from each other, the oar drops out of your hands.

More Physics in Virtual Spaces

If you’re interested in how physics works in virtual spaces in general, be sure to also have a look at our presentation on the subject, which we gave at New York University. Or have a look under the hood of some forklift physics we made for another prototype, as well as at the multiplayer physics prototype which we made for Squido Studio which recently got featured on Venturebeat.

Are you looking to implement some physics in your own VR project? Feel free to reach out to us. We gladly give you a hand in discovering and testing your options.

Leave a comment

Your email address will not be published. Required fields are marked *