onsdag 13 mars 2019

Finished!

The simulation is now finished.

We made the final large addition of being able to control the ball. This means hitting the ball with different golf clubs. The putter is bound to the left mouse button, the drive to the middle one, and the wedge to the right mouse button.

To make the simulation better, we also made some final tweaks to the wind and friction values. The decision was also made to include some boundary walls to the course, in order for the ball to not fly off.

The changes can be seen in the final video, showing a demonstration of the final simulation. 

The course:

The boundary wall:

tisdag 12 mars 2019

Camera, wind, angular friction, air resistance

Today was spent implementing some smaller systems and tweaking some details. We created simple systems for simulating wind and air resistance. When implementing friction, we stumbled into some issues with the models, and decided to simplify the problem slightly. The result was a less realistic and sophisticated model, but much less work required for the implementation.

A very simple camera controller script was also made.

måndag 11 mars 2019

Golf course

We spent an afternoon designing and constructing a simple golf course using planes of different materials. Calculating the positions of the planes so that there would be no gaps was surprisingly time-consuming. It was done through repeated simple trigonometric equations. The resulting golf course can be seen in the video below (to be added). Note that we also added the skybox from lab 2 into the scene.



Additionally, we fixed a problem with the ball intersecting with the plane. It was an issue concerning the order of updating positions and calculating velocities. Now the ball is able to rest on a surface instead of sinking into it repeatedly.

onsdag 6 mars 2019

Material rendering

Materials can now be rendered. In the current state, this simply means that each type of collision material has a .mat file associated with them, which is loaded at the start of the simulation. The .mat file is currently just a simple material with no texture, just a flat color, but it will be easy to change the texture of the materials at a later time.

See some example use of the materials in the video below:



Note that changing material also changes friction/energyloss values but since those aren't added yet the simulation breaks


tisdag 5 mars 2019

Collision response and friction works! Materials do not.

We were able to finish the implementation of collision response and friction. The friction model we use is an Impulse-based friction model. Here is the Wikipedia article: https://en.wikipedia.org/wiki/Collision_response#Impulse-based_friction_model.

The results can be seen in the video below.



Note that only the friction for the test material has been implemented and tested. The other materials that are planned have not been tested or been given proper values.

We also started to overhaul the materials, and so far most of it works. Work still remains on getting the materials to render properly.

måndag 4 mars 2019

Started to implement collision response

We have started to implement the collision response method mentioned in our previous blog post. To our help we have used the inertia tensor of a solid sphere, which we found in this Wikipedia article: https://en.wikipedia.org/wiki/List_of_moments_of_inertia#List_of_3D_inertia_tensors.

The response seems to work partially, where the balls collide with and are stopped by the planes, but no bouncing seems to occur. This can be seen in the video below.


fredag 1 mars 2019

Potential collision response method

While exploring the subject of collision response, we found something called the impulse-based reaction model. Here is the Wikipedia article: https://en.wikipedia.org/wiki/Collision_response#Impulse-based_reaction_model

If we want to use this model for collisions between ball and planes, we will be able to simplify it by assuming that the plane has a mass approaching infinity and has no velocity. Including energy loss and friction in our collisions will be possible, through the impulse-based friction model.

The models require us to simplify the collisions to be instantaneous rather than to happen during a period of time. The models also require us to implement a way for the balls to have an angular velocity.