Hey guys!
Basically, I'm trying to work on the Unity Space Shooter tutorial (The one from the Unity page, with the 3D looking spaceship. NOT the CG Cookie one)
https://unity3d.com/earn/tutorials/projects/space-shooter/moving-the-player
I'm at video # 5.. the "moving the player one"...where they tell me to code with MonoDevelop.
I'm trying to figure out how to create a rigid-body "velocity" component, but at around the 4:30 minute point, there's a caption that tells me that the Tutorial is a bit outdated... and It's no longer possible to access components using "Shorthand Helper References"
Rather, II have to access the "rigid body" component by "get component"... Which I assume is on the Unity Layout and not the Mono Develop.
So far, I've selected "Get Component" and then "Rigid Body" but I'm not sure If I'm on the right path here... Because there doesn't seem to "Velocity" option available.
Meanwhile the video tells me to put in data for the X,Y, and Z access in the Mono Develop code... But I'm struggling to find the equivalent of this on the Unity Layout with my Rigid Body component.
...
So any pointers would be great.
(And yes, I've tried the CGcookie space-shooter version, but there were just too many differences between the video and the system I was working with so that's why I decided to try the Unity Space Shooter)
I replied to your other message directly, but I'll post it here as well so others can see it:
in order to use the Rigidbody class you need to use GetComponent in Start or Awake. In the script they provide they access it directly since that was possible before Unity 5. So in the movement script add a variable for the rigidbody then add a Start method and add GetComponent like this:
public Rigidbody rigid;
void Start ()
{rigid = GetComponent<Rigidbody>();
}
Assuming this script gets applied to the object that has a Rigidbody component. If it doesn't then you can manually assign it but you must specify where this component is located in your script as such:
rigid =rigid.GetComponent<Rigidbody>();