How to Move Make Objects by Adding Force in Unity
There are two methods to make object move in unity:
1. By changing its Transform (Position).
2. By adding Force by using AddForce() method.
In this blog I have mentioned, how we can make object move by adding force. Force and Velocity both are component of Physics. So, to make our gameobject come under influence of Physics we must attach a rigid body to it and then we can code it to move by adding force in different direction. Below is the script for your reference.
using UnityEngine; using System.Collections; public class BallScript : MonoBehaviour { void Update () { if (Input.GetKey (KeyCode.UpArrow)) { this.gameObject.rigidbody.AddForce(0,0,10,ForceMode.Acceleration); } if (Input.GetKey (KeyCode.DownArrow)) .................
See more at:How to Move Make Objects by Adding Force in Unity
You can check more informative blogs and tutorials at android development blogs section and can also browse the android developer forum for posting and viewing latest questions on android development.
1. By changing its Transform (Position).
2. By adding Force by using AddForce() method.
In this blog I have mentioned, how we can make object move by adding force. Force and Velocity both are component of Physics. So, to make our gameobject come under influence of Physics we must attach a rigid body to it and then we can code it to move by adding force in different direction. Below is the script for your reference.
See more at:How to Move Make Objects by Adding Force in Unity
You can check more informative blogs and tutorials at android development blogs section and can also browse the android developer forum for posting and viewing latest questions on android development.
Advertise on APSense
This advertising space is available.
Post Your Ad Here
Post Your Ad Here
Comments