Jump to content
  • Advertisement
Sign in to follow this  
PointInSpace

Unity No appropriate version of 'UnityEngine.Transform.RotateAround'

This topic is 1823 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm getting this error:

 

 Assets/CircularOrbit.js(11,26): BCE0023: No appropriate version of 'UnityEngine.Transform.RotateAround' for the      argument list '(UnityEngine.Vector3, System.Type, float)' was found.

 

Here is my script:

 

#pragma strict
 
function Start () {
 
}
 
function Update () {
   var mountain : GameObject;
// This will return the game object named Hand in the scene.
   mountain = GameObject.Find("QuantumCold_B");
   transform.RotateAround(mountain.transform.position, Vector2,20 * Time.deltaTime);
   
}
 
What I am trying to do is circle around a mountain object which is a mesh.  

Share this post


Link to post
Share on other sites
Advertisement

the 2nd parameter looks wrong. Instead of just Vector2, try Vector3.Up,

 

The 2nd param is the axis that the rotation is to be around. that axis must be in 3d space so it needs a Vector3. Most likely, you want Vector3.Up for it.

Share this post


Link to post
Share on other sites
transform.RotateAround(mountain.transform.position, Vector2,20 * Time.deltaTime);

 

I'm going to guess that the bolded part is supposed to be the rotation axis? If so, you should actually pass it an axis, ie. an instance of a Vector3. Right now you're passing it the type Vector2. RotateAround() expects two Vector3s and a float, and right now you're giving it a Vector3, a type, and a float, just like the error message says.

 

Next time you can solve something like this more quickly by reading what the error message is saying. If you compared the error message to the actual function signature of RotateAround (found http://docs.unity3d.com/Documentation/ScriptReference/Transform.RotateAround.html'>here), I think you would have spotted the problem pretty quickly. Error messages are there for a reason. ;)

Edited by Oberon_Command

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!