- Home /
Question by
fazam0616 · Aug 16, 2017 at 09:54 PM ·
javascripttransformerror messagetarget
It is not possible to invoke an expression of type 'UnityEngine.Vector3'.
I know this has probably already been answered, but I still can't figure this out. I've been running this code:
#pragma strict
public var target : Transform;
function Update () {
transform.rotation.x = target.rotation.x;
transform.rotation.y = target.rotation.y;
transform.rotation.z = target.rotation.z;
transform.position = target.position + target.position(-3,-1,0);
}
And it gives me this error:
It is not possible to invoke an expression of type 'UnityEngine.Vector3'.
The thing is, this code works when I replace :
target.position(-3,-1,0)
with :
Vector3(-3,-1,0)
Thanks if you can help!
Fahim,
Comment
Best Answer
Answer by tanoshimi · Aug 16, 2017 at 10:06 PM
What exactly are you trying to do? As you've already identified, the following makes no sense:
target.position(-3,-1,0);
Did you mean:
target.position + new Vector3(-3,-1,0);
?
Oh, I can try that. I'm quite new to unity, and I'm still trying to figure it out. I'll try that. Thanks!
Your answer
![](https://koobas.hobune.stream/wayback/20220612132849im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
have array target person of most priority/stick with top prior 0 Answers
has anyone seen this javascript error? 0 Answers
Find Transform in the scene 2 Answers
How to restrict rotation 2 Answers
Look at enemy 1 Answer