Rotate: Difference between revisions
-u ndefined- (talk | contribs) m (Put image to infobox, and edit a few paragraphs and files) |
-u ndefined- (talk | contribs) m (Use template and rename to uploaded files) |
||
Line 18: | Line 18: | ||
To move the block, we just add the block's position and the velocity and set that to the block's new position. | To move the block, we just add the block's position and the velocity and set that to the block's new position. | ||
{{Image|Rotate_arrow_movement.png}} | |||
With the Rotate block, we can also rotate a block around a pivot, instead of just the center of block itself. | With the Rotate block, we can also rotate a block around a pivot, instead of just the center of block itself. | ||
Line 26: | Line 26: | ||
Setting the pivot's rotation to the block's rotation is to make it rotate around the pivot instead of circling around it without changing rotation. | Setting the pivot's rotation to the block's rotation is to make it rotate around the pivot instead of circling around it without changing rotation. | ||
{{Image|Rotate_pivoting.png}} | |||
== Related == | == Related == |
Latest revision as of 10:55, 22 May 2024
Type | Script block |
Collider | None |
Folder | Math |
Ports | |
---|---|
Inputs | Vec Rot |
Outputs | Rot * Vec |
Example
You can move a block to the direction that it's facing.
Since the arrow is facing up by default, the velocity of the arrow should be upwards (0, 0, 0.1
).
To get the velocity of the block if it's not facing up, we can rotate the velocity by the block's rotation.
To move the block, we just add the block's position and the velocity and set that to the block's new position.

With the Rotate block, we can also rotate a block around a pivot, instead of just the center of block itself.
To rotate the block around a pivot, we would rotate the vector from the pivot to the block's starting position (not the current position).
Make sure you add the result with the pivot before setting it to the block's new position, otherwise it would end up rotating around the origin point, 0, 0, 0
.
Setting the pivot's rotation to the block's rotation is to make it rotate around the pivot instead of circling around it without changing rotation.
