Skip to content

Instantly share code, notes, and snippets.

@cecilemuller
Last active August 29, 2015 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cecilemuller/323e7bac2e26c8b13098 to your computer and use it in GitHub Desktop.
Save cecilemuller/323e7bac2e26c8b13098 to your computer and use it in GitHub Desktop.
Convert an SFRotation orientation to an SFVec3f direction
#VRML V2.0 utf8
#
# Convert an SFRotation orientation to an SFVec3f direction
#
PROTO OrientationToDirection [
eventIn SFRotation set_orientation
eventOut SFVec3f direction_changed
]{
Script {
field SFVec3f forward 0 0 -1
eventIn SFRotation set_orientation IS set_orientation
eventOut SFVec3f direction_changed IS direction_changed
directOutput TRUE
url "javascript:
function set_orientation(value){
direction_changed = value.multVec(forward);
}
"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment