x


Problem with transform

Hello! I want to do it so that the plane after the collision with the water, change the position of the KKK to the wheels. But while compiling i got error BCE0019: 'transform' is not a member of 'system.type'.

My code:

var wodpart = GameObject; 
var wodpart1 = GameObject;

var kolo1 = Transform; 
var kolo2 = Transform;

var miejsce = Transform;

function OnTriggerEnter (other : Collider) {
    if (other.gameObject.CompareTag ("Water")) {
       wodpart1.transform.position = kolo1.transform.position;
       wodpart.transform.position = kolo2.transform.position; 
    }
}

function OnTriggerExit (other : Collider) {
    if (other.gameObject.CompareTag ("Water")) {
       wodpart1.transform.position = miejsce.transform.position;
       wodpart.transform.position = miejsce.transform.position; 
    } 
}

Please help.

more ▼

asked May 13 '12 at 08:20 PM

matthewpl gravatar image

matthewpl
2 1 1

For what line do you get this error ? Anyway, using transform for kolo1 and 2 and miejsce is redundant, they already are a Transform.

May 13 '12 at 08:38 PM Berenger
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

That's not how you assign types to variables; instead it should be

var wodpart : GameObject;

and same for the others.

more ▼

answered May 13 '12 at 08:47 PM

Eric5h5 gravatar image

Eric5h5
80.1k 41 132 519

(comments are locked)
10|3000 characters needed characters left

The reason you are getting that error is that you are using Transform (with a capital T) which is a type not "transform" which is the current GameObjects transform. You are doing the same with GameObject.

However, did you really mean to have those "="? Looks to me like they should be ":"

more ▼

answered May 13 '12 at 08:47 PM

whydoidoit gravatar image

whydoidoit
32.9k 11 23 98

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2073
x1273
x884
x660
x111

asked: May 13 '12 at 08:20 PM

Seen: 437 times

Last Updated: May 14 '12 at 12:51 PM