align object to Z

How do I adjust the ctrlKey if/then statement so when users hold ctrlKey the object is then aligned vertically?

plugin simpleObject PlanePlus
	name:"Plane Plus"
	category:"Special Primitives"
	classID:#(0x6166ee57, 0x2653467f)
(
	parameters main rollout:rltParams
	(
		height type:#worldUnits ui:uiHeight default:0.0
		width type:#worldUnits ui:uiWidth default:0.0
		mapCoords type:#boolean ui:uiMapCoords default:true
		realWorldMapSize type:#boolean ui:uiRealWorldMapSize default:false
	)
 
	rollout rltParams "Parameters"
	(
		spinner uiWidth "Width:" range:[0, 1e9, 0.0] type:#worldUnits
		spinner uiHeight "Length:" range:[0, 1e9, 0.0] type:#worldUnits
		checkBox uiMapCoords "Generate Mapping Coords" checked:true offset:[0, 9]
		checkBox uiRealWorldMapSize "Real-World Map Size" checked:false
	)
 
	on hasUVW do map_coords
 
	on setGenUVW bool do map_coords = bool
 
	fn genMesh =
	(
		local vertCount = 4
 
		/*Set Vertices*/
		local verticesArr = #([0, 0, 0],[width, 0, 0],[width, height, 0],[0, height, 0])
 
		/*Set Faces*/
		local facesArr = #([1,2,3],[3, 4, 1])
 
		/*Set Mesh*/
		setMesh mesh verts:verticesArr faces:facesArr
		--setMesh mesh verts:verticesArr faces:facesArr materialIDs:#(1,1)-- tverts: --alternate
		setEdgeVis mesh 1 3 false
		setEdgeVis mesh 2 3 false
 
		/*Set Texture Coordinates*/
		if mapCoords do (
			setNumTVerts mesh vertCount
			if realWorldMapSize then
			(
				for i = 1 to vertCount do
				(
					setTVert mesh i verticesArr[i]
				)
			)
			else 
			(
 				local maxLength = amax #(height,width)
 				for i = 1 to vertCount do
				(
 					setTVert mesh i (verticesArr[i] / maxLength + [0, 0, 0])
				)
			)
			buildTVFaces mesh false
			for i = 1 to facesArr.count do
			(
				setTVFace mesh i facesArr[i]
			)
		)
	)
 
	on buildMesh do (genMesh())
 
	tool create
	(
		local first_pos
 
		on mousePoint click do (
			case click of (
				1: (coordSys grid (nodeTM.translation = first_pos = gridPoint))
				2: #stop
			)
		)
 
		on mouseMove click do (
			case click of (
				2: (
						height = length (gridDist * [0, 1, 0])
						width = length (gridDist * [1, 0, 0])
						if shiftKey do (height = width = length (gridDist * [1, 1, 0]))
						if ctrlKey do coordSys grid 
						(
							nodeTM = rotateXMatrix gridAngle.X
							nodeTM.translation = first_pos
						)
				)
			)
		)
	)
)
AttachmentSize
look.jpg80.16 KB
edge.jpg96.55 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
JokerMartini's picture

fixed!

nodeTM = rotateXMatrix 90.0

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.