Jump to content
Developer Wiki and Function Reference Links ×

Reverse Node for Vector to angle?


Recommended Posts



I have to move some objects in an angle but i only got vectors, so i dont know how to calculate a vector out of an angle and there is only "vector to angle" node.



MAybe someone has a reverse node or knows how this goes better with different nodes.


I have a list of path extruded rectangles along lines, which generated out of a polyline (red).




But the profile which is extruded allways is "placed" in the middle (center of bounding box) of my path extrude.


But I need this extrudes BEHIND or INFRONT the line (The Profil has to be extruded in the edge of my ).



So i thought i can read out a list of angles of the lines and use the "MOVE" node to move the Boxes half height and half width.


But the node needs a vector not an angle.




Edited by KingChaos
Link to comment



there is a VS Function that converts an angle into a vector. You can look it up here.


With that Function you can write your own Marionette Node. In Python it could look something like this:

class Params(metaclass = Marionette.OrderedClass):
	this = Marionette.Node( 'Angle to Vector' )
	this.SetDescription( 'Converts an angle in degrees to a 2D vector' )

	#Input Ports
	nAngle = Marionette.PortIn(0) 
	nAngle.SetDescription( 'an angle in degrees' )
	nLength = Marionette.PortIn(1) 
	nLength.SetDescription( 'the length of the output vector' )
	#OIP Controls

	#Output Ports
	v = Marionette.PortOut()  
	v.SetDescription( 'a 2D vector' )

def RunNode(self):	 
	nAngle = self.Params.nAngle.value
	nLength = self.Params.nLength.value

	v = vs.Ang2Vec(nAngle, nLength)
	self.Params.v.value = v


But, as shown in the example below, in some cases the VS function returns realy small numbers instead of zeros. So i would recommend to round the returned values to a reasonable length.


Edited by Letti R
  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...