Chulien Utilisateur confirmé: Rang *****
Messages : 2232
| Sujet: place_free_3d Sam 20 Mar 2010 - 10:01 | |
| salut à tous j'ai décidé de faire partager mon script qui m'a permis de faire de la plate formes 3d c'est un place_free quasiment comme celui de gm (extrêmement plus gourmand...) il permet de savoir si la position d'un certain point (x,y,z) est libre d'objets solides pour l'objet courantchaque objet est un pavé (pas super, mais on peut faire pas mal de choses avec) il faut que chaque objet solide possède les variables: x,y,z et x_d, x_u, y_d, y_u, z_d, z_u qui correspondent au point central, et à l'éloignement de chaque face par rapport à ce point utilisez les place_free_3d avec parcimonie dans vos steps, sinon... ^^ - Spoiler:
- Code:
-
/*
place_free_3d ( xNext, yNext, zNext, thisId ) Original script by Chulien Needs credit for any use (et j'y tiens!) enter the destination of your object, and its id, this script will return true if this place is empty of solid objects and false if it's not. every solid object will be a box, and needs: - parent "obj_solid" - z variable - 6 variables that describes the box of this object x_d, x_u, y_d, y_u, z_d, z_u create examples: this is a 4x4x4 cube centered on (0,0,0) x = 0; y = 0; z = 0; x_d = -2; x_u = 2; y_d = -2; y_u = 2; z_d = -2; z_u = 2; this is an "horizontal" wall with height = 20 length = 60 thickness = 2 dropped on (0,0,0) (base of the wall) x = 0; y = 0; z = 0; x_d = -30; x_u = 30; y_d = -1; y_u = 1; z_d = 0; z_u = 20; */
with(obj_solid) { if( id != argument3 ) { if !( x + x_u <= argument0 + argument3.x_d || argument0 + argument3.x_u <= x + x_d ) { if !( y + y_u <= argument1 + argument3.y_d || argument1 + argument3.y_u <= y + y_d ) { if !( z + z_u <= argument2 + argument3.z_d || argument2 + argument3.z_u <= z + z_d ) { return false; } } } } } return true;
edit: une ligne faisait tache je lai retirée - Spoiler:
if( distance_to_object(argument3) <= 64 && abs( z - argument3.z) <= 64 )
Dernière édition par Chulien le Dim 21 Mar 2010 - 12:13, édité 2 fois |
|
medoc Très bonne participation
Messages : 162 Localisation : 91 Essonne (et j'en dirai pas plus ici ^^) Projet Actuel : F.A.D.W. ~ 15%
| Sujet: Re: place_free_3d Sam 20 Mar 2010 - 10:07 | |
| super! j'ai rien d'autre à dire! |
|