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
1 guest & no users online
30
points ]
 (3 votes)
Created 2019-05-17 21:51
5 years 30 weeks ago
30
points ]
 (3 votes)
Created 2020-06-13 21:05
4 years 26 weeks ago
20
points ]
 (2 votes)
Created 2021-05-24 00:01
3 years 29 weeks ago
8
points ]
 (1 vote)
Created 2024-06-02 14:26
28 weeks 2 days ago
8
points ]
 (1 vote)
Created 2024-06-02 22:13
28 weeks 2 days ago
vampirefrog
Created 2024-04-11 22:25
35 weeks 5 days ago
vampirefrog
29
points ]
 (4 votes)
Created 2010-05-30 10:00
14 years 29 weeks ago
Gangler
36
points ]
 (4 votes)
Created 2020-10-22 00:50
4 years 8 weeks ago
Zoocata
10
points ]
 (1 vote)
Created 2024-02-11 21:20
44 weeks 2 days ago
vampirefrog
10
points ]
 (1 vote)
Created 2023-07-23 20:02
1 year 21 weeks ago
36
points ]
 (4 votes)
Created 2020-12-10 12:49
4 years 1 week ago
Created 2023-12-12 23:34
1 year 6 days ago
Zoocata
Created 2023-11-27 23:00
1 year 3 weeks ago
20
points ]
 (2 votes)
Created 2023-10-01 15:21
1 year 11 weeks ago
9
points ]
 (1 vote)
Created 2023-06-13 17:54
1 year 26 weeks ago
Zoocata
27
points ]
 (3 votes)
Created 2023-05-05 20:58
1 year 32 weeks ago
Zoocata
18
points ]
 (2 votes)
Created 2023-03-02 01:40
1 year 41 weeks ago
Getridou
Created 2023-01-29 23:27
1 year 46 weeks ago
Created 2023-01-19 19:36
1 year 47 weeks ago
Getridou
Created 2023-01-10 17:10
1 year 48 weeks ago
Who's new
  • ColdIV
  • Aidan
  • Hunk
  • letic86
  • BATMAN