Tuesday, December 16, 2014

Unity3D how to instantiate an object position, rotation, scale and color

Okay, so below is how i instantiate a prefab transform position, rotation, scale and color


//so the position x,y,z we set at (6,0.3,-1.5)
//the rotation x,y,z we set at (0,-90,0)

newanimal=Instantiate(cat,Vector3(6,0.3,-1.5),Quaternion.Euler(0, -900));   
        
     
        
        //we scale the cat manually 
        newanimal.transform.localScale = Vector3(2,2,2);



//we set the colour of the cat manually 
        newanimal.renderer.material.color = Color(0.777080.604);

No comments:

Post a Comment