Angle realtime in MaxText

Hey chaps,

I was looking for a way to output the rotation angle of any object realtime
to show in a simple max text object in 3dsmax 8. First I was hoping this could be
done by using the wire parameters but it seems I cannot acces the text.

Im really desperate for a solution to my problem, I hope you guys can help me out.

Thanks in advance,

Mark Verkerk

Comments

Comment viewing options

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

You can convert only full

You can convert only full Quat to Euler, ie:

$.rotation as eulerAngles -- will works
$.rotation.z as eulerAngles -- will not works

but after collecting the value to Euler, you have access to X. Y or Z axis like this:

ra = $.rotation as eulerAngles -- assign to var.
x_str = ra.x as string
y_str = ra.y as string
z_str = ra.z as string
-- example:
$Text01.text = "X: " + x_str + "Y: " + y_str + "Z: " + z_str

Also must to check exactly that builtit Max function works well for you depending of which version of Max you used. For example the quatToEuler2() function (new in Max2008) supposed to be return more correct result than quatToEuler() (old one). But here of my Max2009 and both return reverse value, ie if to say Z axis is -45, both functions return +45, and contrariwise +45 converted to -45. I fix this in Max2009 like this:
$.transform.rotation as eulerAngles
So, some staffs need testing.

my recent MAXScripts RSS (archive here)

Weltensegler's picture

Hi, I have the same request

Hi, I have the same request but can offer some tries, too.
I started scripting yesterday by watching some DVDs so sorry for stupid suggestions or pretendings here.

I want to display the tilt or pitch abgle of an camera in realtime on a MAXTEXT. And it almost works!

first I tried to asign an scriptcontroller to some unimportant part of the text like the text leading.
Then I wrote this here:

pitchValue = $.rotation --var gets the rot
pitch = quatToEuler pitchValue --var converts to euler
content = pitch as string --defines as string for the text
$.text = content --displays the values

0 --keeps the texleading at zero

So this works but it shows also brackets, the words euler angles and the 3point value though I need only a single Xvalue as integer or 2 diggit floating.
AND it does show the worldaxis value means if you tilt by 45 degrees down and then rotate Z then X changes and stops showing the local X

So I tried another:

pitchValue = $.rotation.x
pitch = pitchValue as string
$.text = pitch
0

FINALY a floating number...but wait a minute, these are quat values and for some reason I cant convert them into euler in this script.
AND it still doesnt seem to be the local ones.
Sure, for that I probably could build a 2null rig that follows Zrotation and provides a parent koordinationsystem that keeps the tilt on X.

But I know there are scriptgods out there that can probably script me that solution on their smartphone while having business in the restroom :)

Thanx in advanced!

Weltensegler

Comment viewing options

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