Salatiel | 2022-01-23 15:48
Commands to manipulate faces and edges of a cube (Cube Deformer)
8
points ]
 (1 vote)
Workarounds to allow editing the faces and edges of a cube using commands without requiring a modified client.

The 2020 Edition now has movesel, setselpos, getselpos and editinview commands, which allows us to manipulate the selection in different ways, this script puts these commands together and some workarounds with entities to create gotoface and gotoedge, which adjusts the camera automatically and allows you to move it to any orientation of a selection.

Although much slower and verbose than a real implementation, this can still be useful if you don't want to modify the client :P

Each face and edge has an index ranging from 0 to 3 as shown in the image below.

Faces 4 and 5 are not accessible through the gotoface, requiring you to visit a side face and rotate the cube to access them.

  • gotoface F [C] S
  • Teleports to face F and executes [C]. S is an optional sleep and prevents some sync issues that may occur if there is a nested gotoface.

  • gotoedge E [C] G
  • Teleports to the edge E of the face being looked at and executes [C]. If G is 1, the gridpower will be reduced to the size of the selected edge.

  • moveseldo X Y Z [C]
  • Adds X, Y and Z to the position of the current selection, executing [C] every move.

  • getlookatface
  • Returns the face the camera is looking at relative to the world (not the selected face).

Some commands already available in Sauerbraten 2020 Edition that will be useful:

  • editface D T
  • T determines whether the face (0), selection (1) or edge (2) of a cube will be pushed to D, this is the command you will use to push/pull things.

  • flip
  • Inverts selected geometry. (you can use it to change the back face in addition to the front face without having to use gotoface twice.)

  • movesel A D
  • D determines whether the selection will be moved to x (0), y (1) or z (2) A times.

  • rotate D
  • Rotates once left (-1) or right (1) relative to the selected face, you can use it to change all the edges of the front (and back) face without having to run gotoedge more than once.

  • setselpos X Y Z
  • Sets the position of the current selection to x y and z or creates a new one.

The proper functioning of editface depends a lot on the camera orientation, gotoface is able to correct the yaw of the camera automatically (using a teleport ent), but the pitch can only be adjusted by respawning the player. To get around this there is the gotoface_fixpitch F [C] command, which is basically the same as gotoface, with the difference that it will respawn the player before continuing.

If you don't want to respawn the player just move the camera closer to the horizon manually (it doesn't have to be perfectly aligned).

There are a few more examples in the cubedeformer_examples.cfg file included in the zip.


How to Install
Just download cubedeformer.zip, extract and place the cubedeformer.cfg file in the Sauerbraten root folder and run /exec cubedeformer.cfg ingame.

If you don't want to extract, just include the command addzip cubedeformer.zip; exec cubedeformer.cfg in your autoexec.cfg file (/notepad autoexec.cfg).

that's it, have fun and feel free to leave any suggestion :)



Download
(23/01/2022)
cubedeformer.zip (github)
cubedeformer.zip (google drive)

cubedeformer.zip (5.73 KB)
8
points
 (1 vote)
User login
Users on Quadropolis
2 guests & no users online
32
points ]
 (6 votes)
Created 2010-04-01 07:57
12 years 25 weeks ago
39
points ]
 (4 votes)
Created 2020-12-04 12:05
1 year 42 weeks ago
7
points ]
 (1 vote)
Created 2022-04-21 09:26
22 weeks 3 days ago
8
points ]
 (1 vote)
Created 2022-01-23 15:48
35 weeks 12 hours ago
Created 2021-11-05 01:27
46 weeks 3 days ago
36
points ]
 (4 votes)
Created 2020-12-10 12:49
1 year 41 weeks ago
32
points ]
 (4 votes)
Created 2012-08-30 04:30
10 years 4 weeks ago
10
points ]
 (1 vote)
Created 2019-10-16 01:26
2 years 49 weeks ago
9
points ]
 (1 vote)
Created 2021-06-17 22:42
1 year 14 weeks ago
30
points ]
 (3 votes)
Created 2020-11-30 04:00
1 year 42 weeks ago
10
points ]
 (1 vote)
Created 2021-05-24 00:01
1 year 17 weeks ago
MisanthropX
92
points ]
 (10 votes)
Created 2019-12-05 20:57
2 years 42 weeks ago
20
points ]
 (2 votes)
Created 2020-12-20 03:04
1 year 40 weeks ago
20
points ]
 (2 votes)
Created 2020-12-03 17:12
1 year 42 weeks ago
30
points ]
 (3 votes)
Created 2020-06-13 21:05
2 years 14 weeks ago
60
points ]
 (6 votes)
Created 2020-01-23 12:57
2 years 35 weeks ago
78
points ]
 (8 votes)
Created 2020-10-11 13:46
1 year 49 weeks ago
64
points ]
 (7 votes)
Created 2018-12-04 15:12
3 years 42 weeks ago
Gangler
36
points ]
 (4 votes)
Created 2020-10-22 00:50
1 year 48 weeks ago
LURKing
13
points ]
 (2 votes)
Created 2020-11-22 21:21
1 year 43 weeks ago
Who's new
  • ColdIV
  • Aidan
  • Hunk
  • letic86
  • BATMAN