Space Shooter Movement Scrip not working.,Space Shooter Tutorial Moving The player Errors in parts of code containing Rigidbody.(Insert Velocity, Position, Rotation)
Multiple errors Here they are
CS0030 Cannot convert type 'UnityEngine.Networking.PlayerController' to 'PlayerController'
CS1061 'PlayerController' does not contain a definition for 'playerControllerId' and no accessible extension method 'playerControllerId' accepting a first argument of type 'PlayerController' could be found (are you missing a using directive or an assembly reference?)
CS0117 'Rigidbody' does not contain a definition for 'Velocity'
CS0117 'Rigidbody' does not contain a definition for 'Position'
CS0120 An object reference is required for the non-static field, method, or property 'Rigidbody.position'
(Two of these^)
CS0120 An object reference is required for the non-static field, method, or property 'Rigidbody.rotation'
CS0120 An object reference is required for the non-static field, method, or property 'Rigidbody.velocity' ,Errors include: CS0030 Cannot convert type 'UnityEngine.Networking.PlayerController' to 'PlayerController'
Please Help!
Edit: Added Code
.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class Boundary
{
public float xMin, xMax, zMin, zMax;
}
public class PlayerController : MonoBehaviour
{
public float speed;
public float tilt;
public Boundary boundary;
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
Rigidbody.Velocity = movement * speed;
Rigidbody.Position = new Vector3
(
Mathf.Clamp (Rigidbody.position.x, boundary.xMin, boundary.xMax),
0.0f,
Mathf.Clamp (Rigidbody.position.z, boundary.zMin, boundary.zMax)
);
Rigidbody.rotation = Quaternion.Euler (0.0f, 0.0f, Rigidbody.velocity.x * -tilt);
}
}
Sorry If some might be duplicates, Had to write it twice because I wasn't logged in.
What do you expect we answer if we dont see the code?
And Go step by step, error by error, when it says CS0117 it means the line 117.
Doubleclick at the error at you wil lsee where is in the code. Then try to understand what it says.
When only 3- 4 errors remaining, come back and ask them. But dont expect that we will solve all your problerms. Scripting is not hard, you only need to pay attention.
Bye!
Good Luck!
The wierd thing is though, is that there isn't even over 40 lines of code, as you can see in the code box i just added.
Your answer
Follow this Question
Related Questions
Move Character to touched Position 2D (Without RigidBody and Animated Movement) 1 Answer
Snake movement from Snake VS Block 0 Answers
I have to start moving first to run, and cant start moving in the other direction when running. 0 Answers
Making Character Rotate 0 Answers
I have a colider error 1 Answer