- Home /
HELP BCE0077: It is not possible to invoke an expression of type 'UnityEngine.Vector3'.
Hi everyone, this is my first time posting here and I was wondering if someone could help me fix a mistake in a line of code i am writing for my pool game. Ok so what i am trying to achieve is that when i click the gui button i made, the pool stick moves left relative to the player so as to aim up a spin shot. but when i try i get the error " BCE0077: It is not possible to invoke an expression of type 'UnityEngine.Vector3'. which i dont understand because i was able to achieve a rotation of the cue but not position. Here's my code and any help is greatly appreciated because i just started learning java script 1 week ago and i know no other languages.
var cue : Transform;
var rotateamount : float = .07;
var leftbuttonpositionx : float;
var leftbuttonpositiony : float;
var rightbuttonpositionx : float;
var rightbuttonpositiony : float;
var upbuttonpositionx : float;
var upbuttonpositiony : float;
var downbuttonpositionx : float;
var downbuttonpositiony : float;
function OnGUI ()
{
if (GUI.Button (Rect (leftbuttonpositionx, leftbuttonpositiony, 100, 50), "Left Spin"))
cue.transform.position (0, - (rotateamount), 0);
}
Right where I put "cue.transform.position" is the error which is where i get lost because if i substitute .position with .Rotate everything works fine as expected. I was under an impression that Rotation and position are of similar type. Are they of a different class? Thanx in advance, hope to here back.
Answer by Eric5h5 · Oct 01, 2010 at 01:41 AM
You have to set transform.position to a Vector3.
cue.transform.position = Vector3(0, - (rotateamount), 0);
oh ok thank you very much erich5h5. that was very simple. thanks again.