In the first screen shot, I have done it so you can see the basic test scene that I have created. Over on the right hand side you can see the three scripts that I have used, the first one is the Object Properties script, which is in C#, this script is attached to the object that you want to pick up. For this script to work, the object needed a collider so that the character controller could be able to pick it up, it also needed a rigid body component added to it. The next script is another C# script, this is attached to the character controller which enables it to be able to pick up the object when the player presses the 'f' key, as well as being able to throw the object when the player clicks the left mouse button. The final script is Javascript, this is also on the character controller, and this controls the power in which the object is thrown by the character. I still need to tweak the power in which the object is being thrown, because at the moment it is too powerful.
The bottom screenshot shows the character controller holding the object (I could not print screen the throw action because it disappeared before I could!!).
No comments:
Post a Comment