Salatiel | 2022-01-23 15:48
Commands to manipulate faces and edges of a cube (Cube Deformer)
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, 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; exec cubedeformer.cfg in your autoexec.cfg file (/notepad autoexec.cfg).

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

(23/01/2022) (github) (google drive) (5.73 KB)
 (1 vote)
User login
Users on Quadropolis
1 guest & no users online
Created 2024-02-11 21:20
20 hours 1 min ago
points ]
 (1 vote)
Created 2023-07-23 20:02
29 weeks 21 hours ago
points ]
 (4 votes)
Created 2020-12-10 12:49
3 years 9 weeks ago
Created 2023-12-12 23:34
8 weeks 5 days ago
Created 2023-11-27 23:00
10 weeks 6 days ago
points ]
 (2 votes)
Created 2023-10-01 15:21
19 weeks 1 day ago
points ]
 (2 votes)
Created 2021-05-24 00:01
2 years 37 weeks ago
points ]
 (1 vote)
Created 2023-06-13 17:54
34 weeks 5 days ago
points ]
 (3 votes)
Created 2023-05-05 20:58
40 weeks 2 days ago
points ]
 (2 votes)
Created 2023-03-02 01:40
49 weeks 4 days ago
Created 2023-01-29 23:27
1 year 1 week ago
Created 2023-01-19 19:36
1 year 3 weeks ago
Created 2023-01-10 17:10
1 year 4 weeks ago
Created 2023-01-01 14:30
1 year 6 weeks ago
Created 2023-01-01 10:58
1 year 6 weeks ago
Created 2023-01-01 10:49
1 year 6 weeks ago
points ]
 (2 votes)
Created 2023-01-01 06:32
1 year 6 weeks ago
points ]
 (7 votes)
Created 2010-04-01 07:57
13 years 45 weeks ago
points ]
 (6 votes)
Created 2020-12-04 12:05
3 years 10 weeks ago
points ]
 (1 vote)
Created 2022-04-21 09:26
1 year 42 weeks ago
Who's new
  • ColdIV
  • Aidan
  • Hunk
  • letic86