Is it possible to rotate a heightfield output?
1862 2 1- soma wheels
- Member
- 27 posts
- Joined: Oct. 2015
- Offline
- cs_pix
- Member
- 23 posts
- Joined: July 2015
- Offline
- cs_pix
- Member
- 23 posts
- Joined: July 2015
- Offline
I used this code in a volume wrangle:
1: Get the current position of the volume voxel
2: Because the center of the volume might not be at (0,0,0) we offset the voxel pos by the center position
3: Create a new vector position by rotating X to minus Z. (This is +90 degree rotation. Use (0,0,1) for -90)
4: Create a new vector called sample pos. by added the center offset.
5: Sample the volume
6: Assign height the sample value
This works only on square HF
Cheers!
vector current_pos = @P; current_pos -= @center; vector rot_pos = rotate_x_to(set(0,0,-1), current_pos); vector sample_pos = set(rot_pos.x, 0, rot_pos.z) + @center; float sample = volumesample(0, 0, sample_pos); @height = sample;
1: Get the current position of the volume voxel
2: Because the center of the volume might not be at (0,0,0) we offset the voxel pos by the center position
3: Create a new vector position by rotating X to minus Z. (This is +90 degree rotation. Use (0,0,1) for -90)
4: Create a new vector called sample pos. by added the center offset.
5: Sample the volume
6: Assign height the sample value
This works only on square HF
Cheers!
Edited by cs_pix - Nov. 9, 2018 17:56:49
-
- Quick Links