Ejemplo n.º 1
0
	public virtual bool SetRotation( Vector3 rotation, AGF_GridManager.PivotType pivotType ){
		if ( this.keepUpright == false ){
			this.transform.eulerAngles = m_InitialRotation + rotation;
		} else {
			Vector3 newRot = m_InitialRotation;
			newRot.y += rotation.y;
			this.transform.eulerAngles = newRot;
		}
		
		// if we are rotating around the center of the object, adjust the offset position of the object as well.
		if ( pivotType == AGF_GridManager.PivotType.Center ){
			placementOffset = ( Quaternion.Euler( rotation ) * m_CenterOffset - m_CenterOffset );	
		} else if ( pivotType == AGF_GridManager.PivotType.Bottom ){
			placementOffset = Vector3.zero;
		}
		
		return this.keepUpright;
	}
Ejemplo n.º 2
0
 private void Start()
 {
     m_GridManager = GameObject.Find ("AGF_GridManager").GetComponent<AGF_GridManager>();
 }