- Home /
Duplicate Question
How to move a Sphere using physics
Hi!, Im new to Unity and have some experience with programing on calculators, so i decided to start by move a sphere with physics sounded simple enough well it wasnt, been getting error after error and after reading a lot i just cant solve it.
My curent problems are the following:
And my code looks like this:
using UnityEngine;
using System.Collections;
public class PlayerControler : MonoBehaviour
{
public float speed;
void Start();
{
Rigidbody sphere = GetComponent<Rigidbody>();
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
}
void FixedUpdate ();
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Sphere.Rigidbody.AddForce(movement * speed * Time.deltatime);
}
}
Can anyone please help me? (btw escuse me if i have bad grammar or any other problem in my writting)
I retagged your question so you can go look at questions asking about cs1519. Since the error message tells you the line number where the problems happen, you should be able to work this out.
Follow this Question
Related Questions
Error: Cannot cast from source type to destination type 2 Answers
Top-down space flight physics - AddForce - Object moves off center the faster it goes 0 Answers
Collision error 1 Answer
Car Movment Script not fully working!!!!!!! 1 Answer
How not to make a RigidBody not go into ground when tilted foward? 1 Answer