Coordinats of Multiple selected objects

Coordinats of Multiple selected objects

kem.star
Contributor Contributor
609 Views
2 Replies
Message 1 of 3

Coordinats of Multiple selected objects

kem.star
Contributor
Contributor

Hey Guys,
for a Game with an editional Map editor i need the Coordinats and optionaly the Rotation of all the Selected Objects in 3dsmax.
The selectable count should be high as possible and the coordinats/rotation should be copyable (need them to insert in the other editor)

Should be look like this

If 10 Objects Selected and i Run the Script , it should give me in the listener something like

Coordinates
Object 1(1,1,1)
Object 2(2,2,2)
Object 3(3,3,3)
Object 4(4,4,4)
...
Object 10(10,10,10)

Rotation
Object 1(90,0,0)
Object 2(65,0,0)
Object 3(30,0,0)
Object 4(270,0,0)
...
Object 10(359,0,0)

0 Likes
Accepted solutions (1)
610 Views
2 Replies
Replies (2)
Message 2 of 3

JokerMartini23
Enthusiast
Enthusiast
Accepted solution

The rotation will be a slight bit more work because it's most likely handled differently in your game versus 3ds Max. However here is a start. This snippet will do the coordinates. For the sake of you learning try to modify it to do rotation yourself.

 

 

 

clearlistener()
sel = getCurrentSelection()

print "Coordinates"
for i = 1 to sel.count do
(
	obj = sel[i]
	pos = obj.pos

	format "Object % (%,%,%)\n" i pos.x pos.y pos.z
)

 

Message 3 of 3

kem.star
Contributor
Contributor

It worked perfectly thx dude.

If anyone need the rotation too.. heres the solution

clearlistener()
sel = getCurrentSelection()

print "Coordinates"
for i = 1 to sel.count do
(
	obj = sel[i]
	pos = obj.pos

	format "Object % (%,%,%)\n" i pos.x pos.y pos.z
)

print "Rotation"
for i = 1 to sel.count do
(
	obj = sel[i]
	rotation = obj.rotation

	format "Object % (%,%,%)\n" i rotation.x rotation.y rotation.z
)
0 Likes