5 registered members (AndrewAMD, ozgur, Ayumi, 2 invisible),
690
guests, and 10
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: TUST or "The community library"
[Re: PadMalcom]
#425345
07/03/13 12:21
07/03/13 12:21
|
Joined: Jan 2004
Posts: 3,023 The Netherlands
Helghast
Expert
|
Expert
Joined: Jan 2004
Posts: 3,023
The Netherlands
|
Looks nice and can be put into the GUI section. Do you already have access to the Hub? EDIT: After a 3 days fight I implemented Voronoi Diagrams for the procedural part of TUST (my secret love). It can, for example, be used to generate random road networks for cities. Really interested to read this! Where can I find the source of this (glanced over the github, couldnt find it easily)? regards,
|
|
|
Re: TUST or "The community library"
[Re: txesmi]
#426859
07/30/13 21:10
07/30/13 21:10
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
OP
Expert
|
OP
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
I've reworked the usage of the character controller. It is now flexible and customizable. Some values are still hardcoded and docs are missing, but the core system is stable. The CCT is now detached from a specific entity and doesn't modify the camera, so it can be used for NPCs as well. Usage for a simple third person player:
action player_func()
{
// Allow only one player!
if(proc_status(player_func) > 1)
{
error("Only one player can be active at a time!");
return;
}
my->z += 8; // Lift player up a little to prevent falling through ground
// Setup the camera
cam_target(me); // Focus the player
cam_mouse_speed(25); // Set a fast mouse.
cam_basic_offset(vector(0, 0, 20)); // We want a camera focus a little bit above the player
cam_3person_offset(vector(-250, -30, 0)); // We want to camera to be behind
cam_set_mode(CAMERA_THIRD_PERSON); // Enable third person camera
// Setup the CCT
CCT *cct = cct_create(my.x, vector(10, 16, 46));
while(1)
{
cam_update(); // Update the camera each frame
my->pan = camera->pan; // We sync the entity rotation with the camera
// Setup the cct input
cct_set_input(cct, CCT_FORWARD, key_w - key_s);
cct_set_input(cct, CCT_SIDEWARD, key_a - key_d);
cct_set_input(cct, CCT_JUMP, key_space);
cct_set_input(cct, CCT_CRAWL, key_ctrl);
cct_set_input(cct, CCT_SPRINT, key_shift);
cct_set_rotation(cct, my->pan);
cct_update(cct); // Update the character controller
cct_get_position(cct, &my->x); // Get the position of the character
wait(1);
}
}
Last edited by MasterQ32; 07/30/13 21:11.
|
|
|
|