Ball Control fail Nr2 Help !

Updated on January 9, 2017 in [A] Unity Scripting
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
2 on January 9, 2017

Can someone help my i have typed :

#pragma strict
var rotationspeed = 100;
function Update ()
{
var rotation : float = Input.GetAxis ("horizontal") * rotationspeed;
rotation *=Time.DeltaTime;
rigidbody.AddRelativeTorque (Vector3.back * rotation);
}Problems

Assets/BallControl.js(6,17): BCE0019: ‘DeltaTime’ is not a member of ‘UnityEngine.Time’. Did you mean ‘deltaTime’?

Assets/BallControl.js(7,1): BCE0144: ‘UnityEngine.Component.rigidbody’ is obsolete. Property rigidbody has been deprecated. Use GetComponent<Rigidbody>() instead. (UnityUpgradable)

Assets/BallControl.js(7,11): BCE0019: 'AddRelativeTorque' is not a member of 'UnityEngine.Component'. 

  • Liked by
Reply
1 on January 9, 2017

first error it’s deltaTime not DeltaTime, second error you need to actually make a reference to the rigidbody using GetComponent https://docs.unity3d.com/ScriptReference/GameObject.GetComponent.html

on January 9, 2017

thanks

Show more replies
  • Liked by
Reply
Cancel