Sign in to follow this  
PointInSpace

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

Recommended Posts

PointInSpace    102

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
shazen    291

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
Oberon_Command    6081
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 [url=http://docs.unity3d.com/Documentation/ScriptReference/Transform.RotateAround.html]here[/url]), 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this