Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Script] Auto facing/rotation

September 28 (11 years ago)

Edited February 15 (11 years ago)
Palm
Plus
Obsolete: go here => https://app.roll20.net/forum/post/652987/script-automatic-facing/#post-652987

This script will automatically change the direction tokens are facing when moved around. So they will always have their back from whence they came and their eyes locked forward in the direction you moved them. You can rotate them independently afterwards of course, it only triggers on moving the character.

Only affects objects on the object layer. Also, objects named "NR" (no rotation) will not be affected by this script.

https://gist.github.com/anonymous/6741062
September 28 (11 years ago)
This isn't working right... if I move up, they face down. If I move down, they face up. Same with left/right.
September 28 (11 years ago)

Edited September 28 (11 years ago)
Palm
Plus
Hrmm.. I would suspect this is due to the token. Its designed for tokens that face the direction you drag the little piston towards. That is tokens that look upwards in the library.

Flipping them vertically should do the trick.
September 28 (11 years ago)
All of devin nights tokens are made facing down by default.
September 28 (11 years ago)
Palm
Plus
Id change line 33 to
obj.set("rotation", degs+180);
to adjust for that then.
September 28 (11 years ago)

Edited September 28 (11 years ago)
Cool. That worked!