Unable to convert: [0,-150,0] to type: Quaternion : Help please

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Search this Thread Display Modes
  04 April 2014
Question Unable to convert: [0,-150,0] to type: Quaternion : Help please

Hello guys

I'm really stuck with this for sometime now can someone help me fix this error please.

The issue I having is this "Unable to convert: [0,-150,0] to type: Quaternion" in "SliceRotation" and I have no idea what that means.

I am trying to rotate the slice plane in any directions.

Can someone fix or explain this to me very much would appreciate any help I can get thanks.


if ((Test != undefined) and (Test.IsDisplayed )) do (destroyDialog Test)

rollout test "Slice me up" width:372 height:213
(
 
	spinner spn_slice "Slice:" pos:[24,13] width:201 height:16 range:[-70,150,0] type:#float
	spinner spn_Slice_Plane2 "Slice Plane 2:" pos:[31,53] width:161 height:16 range:[-150,150,-150]
	spinner spn_Slice_Plane3 "Slce Plane 3:" pos:[27,89] width:197 height:16 range:[-150,150,-150]
	spinner spnSlice_Rotation "Slice Rotation" pos:[23,126] width:283 height:16 range:[-150,0,-150]
	button but_Go "Go" pos:[144,169] width:60 height:21
 
 local SliceMe
  local SliceMe2
	 local SliceMe3

	local SliceRotation

	on spn_slice changed value do --
	(
	-- 
	 if SliceMe != undefined and not isdeleted SliceMe do
	 (
	-- 
	  SliceMe.slice_plane.position = [0.0, spn_Slice.value, 0.0]
	 ) 
	) 
	on spn_Slice_Plane2 changed value do
	(
			 if SliceMe2 != undefined and not isdeleted SliceMe2 do
		 (
		
		  SliceMe2.Slice_plane.position = [0.0, spn_Slice_Plane2.value, 0.0]
		 ) 
	)
	on spn_Slice_Plane3 changed value do
	(
			 if SliceMe3 != undefined and not isdeleted SliceMe3 do
		 (
		
		  SliceMe3.Slice_plane.position = [0.0, 0.0, spn_Slice_Plane3.value]
		 )
	)
	on spnSlice_Rotation changed val do
	(
		if SliceRotation != undefined and not isdeleted SliceRotation do
		 (
		
		  max rotate 
		  SliceRotation.Slice_plane.rotation = [0.0, spnSlice_Rotation.value, 0.0]  -- here is the issue
		 )
	)
	on but_Go pressed do
	(
	try (

	 b = box length:145 width:140 height:132 lengthSegs: 3 widthSegs: 10 heightSegs:4 pos:[0,0,0] 


		select b
		convertToPoly b
	 SliceMe = sliceModifier() 
	 addModifier b SliceMe 
	 SliceMe.Slice_Type = 3 
	 SliceMe.slice_plane 
	 SliceMe.Slice_Plane.rotation = quat 90 [1, 0, 0] 
	 SliceMe.slice_plane.position = [0.0,-12.0,0.0] 
	
	 SliceMe2 = sliceModifier() 
	 addModifier b SliceMe 
	 SliceMe.Slice_Type = 3 
	 SliceMe.slice_plane 
	 SliceMe.Slice_Plane.rotation = quat 90 [1, 0, 0] 
	 SliceMe.slice_plane.position = [0.0,-12.0,0.0] 
		
	 SliceMe3 = sliceModifier() 
	 addModifier b SliceMe 
	 SliceMe.Slice_Type = 3 
	 SliceMe.slice_plane 
	 SliceMe.Slice_Plane.rotation = quat 90 [1, 0, 0] 
	 SliceMe.slice_plane.position = [0.0,-12.0,0.0] 


	 SliceRotation = sliceModifier() 
	 addModifier b SliceMe 
	 SliceMe.Slice_Type = 3 
	 SliceMe.slice_plane 
	 SliceMe.Slice_Plane.rotation = quat 90 [1, 0, 0] 
	 SliceMe.slice_plane.position = [0.0,-12.0,0.0] 
	 
	)
	 
	 catch()
	
	)
)
createdialog Test style:#(#style_toolwindow, #style_sysmenu)
 
  04 April 2014
Why not manipulate the Y-axis directly?

SliceRotation.Slice_plane.rotation.y_rotation = spnSlice_Rotation.value

The other problem is your trying to inject a rotation controller with a point3 value, it expects quaternion of eulerAngles values. Look them up in the help file.

Goodluck,
-Johan
__________________
Online: LinkedIn
 
  04 April 2014
Originally Posted by JHN: Why not manipulate the Y-axis directly?

SliceRotation.Slice_plane.rotation.y_rotation = spnSlice_Rotation.value

The other problem is your trying to inject a rotation controller with a point3 value, it expects quaternion of eulerAngles values. Look them up in the help file.

Goodluck,
-Johan


Thanks JHN for the reply ! And thanks for wishing me luck I'm going to need it.

I'm a newbie to Maxscript.

I been trying to manipulate Y-axis, X-axis, Z- axis but couldn't figure it out.

The reason why I've added the rotation controller is when the user changes the spinner it select the rotation controller and rotates the slice plane let say as example only the Y-axis.

I'll looked them up and I don't really understand anything about them or how to implement them.

Last edited by JimN587 : 04 April 2014 at 04:36 PM.
 
  04 April 2014
It's a good thing to understand what the different parts in a max object mean.
Most parts in max are "objects and classes" and few parts are values.
With animation you mostly want to manipulate values and not so much the objects. But you have to understand that the values are mostly stored inside the objects. So we need to understand how to traverse/travel through the objects to get to the values.

The best way to learn it is by using the trackview. Select an object and open the trackview. The structure of the object, with it's transforms, modifiers etc is exactly the path you need to take to get to a value in maxscript.

So a modifier bend angle value would be.

(by index)
$objectname.modifiers[1].angle = 10


or

(by name, risky when you have multiple bend modifiers)
$objectname.bend.angle = 10


Now we've set the value of the bend angle.
Also a very good thing to know is when you're working with a controller and when not.
Besides the postion, rotation and scale controllers, max by default doesn't assign controllers to something like the bend angle, it's saves memory and overhead. Controllers are only needed when you want to animate things and need keyframes otherwise a single value is fine.

so if we want to animate the bend angle we assign a controller and then a value
$objectname.bend.angle.controller = bezier_float()
$objectname.bend.angle.controller.value = 50
addNewKey $.modifiers[1].angle.controller 10
print $.modifiers[1].angle.controller.keys[1]

In max there's many ways to set keyframes this is just one that explains the hierarchy of things a bit. If you understand how to traverse a scene and it's nodes, then maxscript will be much simpeler for animation tasks. you can manipulate keys, modifiers and objects on values and controllers etc.

Hope it's of some help!

-Johan
__________________
Online: LinkedIn
 
  04 April 2014
Thanks for taking the time to reply Johan !

Any help or advice is very much appreciated.

I'm try to do this at moment and its throwing me a weird error "Unknown property: "y_rotation" in [0,0,0]"

 SliceRotation.Slice_plane.position.y_rotation[4].angle = [0.0,spnSlice_Rotation.value, 0,0]


I'm also trying to use this, again its throwing me a another weird errors

SliceRotation.Slice_plane.controller[3] = [0.0, 0.0, spnSlice_Rotation.value]


"No ""put"" function for Controller:Position_Rotation_Scale" &

"Type error: Assign needs controller, got: [0,0,-150]"

Could you please explain to me how the Point3 values works when your appealing to a modifier sub object level as an example the slice plane.

Sorry for the trivial questions.

Many thanks in advances.

Last edited by JimN587 : 04 April 2014 at 07:22 AM.
 
  04 April 2014
You really need to take step back and read the error messages a bit better, they explain all your problems.

Quote: I'm try to do this at moment and its throwing me a weird error "Unknown property: "y_rotation" in [0,0,0]"
 SliceRotation.Slice_plane.position.y_rotation[4].angle = [0.0,spnSlice_Rotation.value, 0,0]



First your going into the POSITION controller and try to set a ROTATION value. That can never work.
Second "y_rotation[4]" what are you trying to access here? A y rotation has only keys and values, it's a controller with a single value, which you are trying to access via y_rotation[4].angle? Angle itself is again a single value (like 1.2) and your trying to input a point 3 value like [1.0,2.2,3.1], that will never work.

So you need to use
sliceRotation.slice_plane.position.x_position = 1.9

or
sliceRotation.slice_plane.rotation.x_rotation = 45

That for single axis' assignment. If you want to set a complete rotation you'll need something like
sliceRotation.slice_plane.rotation = eulerAngles 45 0 0


I'm pretty sure you can now figure out the other problem, you're trying to assign a value to a controller. You have to either go further and find the right controller to assign the value to. Now you're trying to assign a value to a controller that expects either a matrix3 value or a matrix3 controller, while you're trying to assign a point3 value to it. That can never work. Also lookup subAnims in the helpfile, I didn't want to complicate it too much, but it's helpful to understand that concept too.

Good luck

-Johan
__________________
Online: LinkedIn
 
  04 April 2014
Thumbs up

Originally Posted by JHN:
sliceRotation.slice_plane.rotation = eulerAngles 45 0 0


This was exactly what I wanted to do by following your example and changing eulerAngels hard code value to the spinner value, I was able to rotate the slice plane only on Z-axis.

Thank you for showing me this example.

Is there a way to reset the slice plane to its original starting positions ? As an example if you select the sub object level and move the slice plane really far away from the object, and you wanted to reset the slice plane back to the object regardless of where the object is.

Could you please give me a example or explain how I could do this ?

Many thanks in advance Johan.

Jim
 
  04 April 2014
Sure thing, it's a process normally called "zero out".
Basically you need to set all values to : 0.0, eulerangles 0 0 0 or [0,0,0].
Effectively resetting the modifier to it's starting point. Again inspect the curve editor to understand how things are structured and what the default values are.
Just assign a modifier and inspect the values, will work with anything. Mostly in animation and rigging you have a setup pose/value on any controller. But the actual keyframes are up a layer higher, starting at zero. An animator can now always return to the default pose.

Cheers,
-Johan
__________________
Online: LinkedIn
 
  04 April 2014
Cheers for the tip !

I'll figure out something.

Thanks you for helping me for the pass couple of weeks and finding the time to reply to my questions and issues its been an really big help ! If I have any further questions or problems I won't hesitate to post a reply.

Again thank you for all the help and have a nice day Johan.

Jim
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 12:20 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.