Dev Log #1 – Wheelchair Controller

Introduction

Figure 1 Our team’s Logo

In short, we (6 members of team Tamago) decide to make a VR horror game by Unity 5.4 for our capstone project. In the next 6 months, we will start building the project from scratch. Therefore, I decide to write some dev logs in order to record our progress as well as for future reference.

To summarize our game, as I mentioned above, it is a VR horror/ Adventure game happens in an abandoned Asylum, the player has to maneuver his wheelchair in order to move around as well as explore the possible routes to escape. It will be a story based game which contains lots of dialogs and audio logs (collectables). The aimed play length will be around 30 mins, not quite long, yet there are still a lot of things to be done.

Wheelchair controller


Figure 2 The wheelchair prototype we are working on.

Since the only way for player to move around is by maneuvering the wheelchair, it is quite important for us to build a satisfying controller for player to play with, after all, it is the fundamental of the game.

Figure 3 Wheel collider on the prototype.

Therefore, in order to simulate the real world’s physics, I choose to use the rigidbody + wheel collider to do the work. However, although it provides real world simulation, it also brings troubles: there are lots of aspects you have to consider, from wheel mass to friction.

Figure 4 Wheel collider variables

And I must say, one thing that keeps messing around is the friction of wheels, low friction results slippery and it happens a lot when player is trying to turn, what is causes is losing control. So sideways friction must be carefully considered and tested to prevent slippery from happening. Based on Unity’s official document:

 

 

 

 

Figure 5 Typical shape of a wheel friction curve

Tire friction can be described by the Wheel Friction Curve shown above. There are separate curves for the wheel’s forward (rolling) direction and sideways direction. In both directions, it is first determined how much the tire is slipping (based on the speed difference between the tire’s rubber and the road). Then this slip value is used to find out tire force exerted on the contact point.

The curve takes a measure of tire slip as an input and gives a force as output. The curve is approximated by a two-piece spline. The first section goes from (0, 0) to (ExtremumSlipExtremumValue), at which point the curve’s tangent is zero. The second section goes from (ExtremumSlipExtremumValue) to (AsymptoteSlipAsymptoteValue), where curve’s tangent is again zero.

The property of real tires is that for low slip they can exert high forces since the rubber compensates for the slip by stretching. Later when the slip gets really high, the forces are reduced as the tire starts to slide or spin. Thus, tire friction curves have a shape like in the image above.

https://docs.unity3d.com/Manual/class-WheelCollider.html

 

Yet, in the end, I found out that by modifying both extremum and asymptote can not fully remove slippery from the game, what I did was adding the stiffness value, from 1 to 5, which resulted dramatically friction reduce.

Moreover, there are two things I would like to mention about. First, in order to prevent car (or wheelchair, in our case) from flip over when turning, one thing could be done is modifying the center of mass value in rigidbody component. From center (0f, 0f, 0f), to bottom (0f, -2f, 0f) will do the job.

Secondly, I also found out that, wheel collider is not standard collider like box collider or so. It is not compactable with hinge and another physics component. Therefore, the only way to apply force to the wheel is by adding the motorTorque property in wheel collider rather than adding a rigidbody in-game object.

Controls

Regarding the controls, we are still playing with it to find out the best way to simulate the wheelchair. For now, what I decided to use is left and right joysticks simulates the corresponding wheels on wheelchair. Since the final decision haven’t made yet, I will save it for the next dev log.

In the next post, I will be mainly discussing the controls of our game, from xbox controller to VR.


Tagged: , ,

Leave a comment

Your email address will not be published.