Wednesday, 23 November 2016
Picking Up and Throwing
I want to include a picking up and throwing mechanic in my game. However due to my current programming knowledge this is easier said than done.
I used the same teleport code for respawning for my pick up objects. I attached the target area to the main camera so that the object will always move in relation to the camera. I also made sure that the object is also parented to the target area, so that I can attach the the collected object to the target area.
When the player drops the object the object is no longer parented to the target area and therefore can fall and land anywhere in the 3D space. This is where the issues arise. The dropped objects have the habit of either floating in space or falling through objects. Also on some occasions collected objects can clip outside the environment when the player turns the camera. Then when the player drops the object it will continue to fall through space.
I've tried solving this issue by creating a trigger on the floor. When the object is on the floor the gravity on that object is turned off. This prevents the possibility of the object falling through the floor. I then turn the gravity on when the player drops the object. That way the object can fall towards the floor and when it reaches the floor the gravity will turn off.
I've also made sure there are object colliders on the walls of the environment, but they do not stop objects leaving the environment 100% of the time. This is when the throwing mechanic becomes a nightmare.
I still haven't solved the throwing mechanic issues. For reasons I believe to be related to the VR camera mechanic objects cannot identify which direction the camera is pointing. The code allows the object when the player drops it to use physics to propel forward from the camera. However objects can fly in any direction. They also can either clip through or even get stuck on objects with colliders.
Until I solve this issue I've turned off the throwing mechanic entirely. I've only attached the pick up mechanic to the teddy to allow the player to activate the respawning sequence when done so. The idea is to try and build a sense of comfort and reliability between the player and the teddy.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment