How We Used Bezier Curve to Create VR Bike Experience
Today, businesses need to be able to create a memorable embodied experience, so that users were impressed by what they see and wanted to invest money. This is exactly where virtual reality comes into play, enabling landowners to offer lifelike presentations conveying the sense of belonging to the places potential home buyers could live in. One of our customers, an enterprise from the US, needed to create a VR experience for the new suburb community. They required a guided bike tour to enable future community members to virtually ride through the large greenway park and experience of what it will be like when finished. So, we came up with an idea of using a Bezier Curve capable of handling the challenge. In this article, we will cover the bike route implementation process as well as the pitfalls we had to overcome along the way.
What is the Bezier Curve?
A Bezier curve is a mathematically defined curve applied in two-dimensional graphics applications. The curve is defined by four points: the initial position and the terminating position and two separate middle points.
Why Using Bezier Curve Is An Answer
It is clear that setting points manually cannot work in this situation. The task was to create the VR bike ride simulation experience that would last 3.5-5 minutes total. To model a specific route for the cyclist in VR, we generated a curve that would simulate that path. As combinations of linked Bézier curves can be used to generate “paths” we decided to apply this method. This is how we did it.
An important first step in route implementation was a creation of an editor extension in Unity, where we would generate a curve. At first sight, it seemed that the task was done. But computer graphics recognizes only data points, so we converted that curve into the set of points. We used the curve we had created before and defined its points.
Due to particular time frames bike should move with the same speed, thus data points must be equidistant. So we applied one more method – the Linear interpolation.
To place points evenly, we converted curve length into the appropriate amount of points. The more points you use the more accurate the line will match Bezier curve (we used around 100 points). If the two known points are given by the coordinates, the linear interpolant is the straight line between these points. By having a set of data points we defined linear interpolants between each pair of data points. By knowing the curve length we found out where to put each next point.
After setting points on the same distance, we obtained the route for VR bike ride.
What’s next?
Well, the results are encouraging. And there is a long way we can go further to implement the whole community in VR. As for now, we are working on 3D models of roads, vegetation, and home types, so stay tuned! Some new challenges are coming!
See also: Augmented Reality Fitness Apps and How We Develop Them
Related: How Much Does VR Training Simulator Development Cost?