x


How to attach a terrain to an object?

Hi, I need to attach a terrain to a spaceship so it can move along with it,the ship can go up and down, left and right, and speed up or slow down, I also want the terrain to be invisible, is there a way to do that?? thanks in advance

more ▼

asked Apr 24 '12 at 12:39 AM

Tina gravatar image

Tina
0 1 1

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

1 answer: sort voted first

Just child the terrain object to the space ship object to make it stick with it, and to make the terrain invisible for whatever reason then set it's terrain enabled to false.
quick test : throw this on your terrain object and try it ->

function Update(){
   if(Input.GetKeyDown(KeyCode.T))
      gameObject.getComponent(Terrain).enabled = false ;
 
   if(Input.GetKeyUp(KeyCode.T))
      gameObject.getComponent(Terrain).enabled = true ;
}
more ▼

answered Apr 24 '12 at 02:35 AM

Lo0NuhtiK gravatar image

Lo0NuhtiK
3.5k 1 9 39

thank you

Apr 24 '12 at 09:21 PM Tina
(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:

x1478
x1373
x1095
x80
x49

asked: Apr 24 '12 at 12:39 AM

Seen: 493 times

Last Updated: Apr 24 '12 at 09:21 PM