AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [Tutorial] Creating brush entities (https://forums.alliedmods.net/showthread.php?t=129597)

flud 07-08-2010 08:48

Re: [Tutorial] Creating brush entities
 
it again me :|

possible to set texture on brush ? or make it visible ?

blodia 07-08-2010 09:50

Re: [Tutorial] Creating brush entities
 
you can't do that as that requires bsp models. closest you can do it place a prop_dynamic as mentioned in the first post or maybe an env_sprite_oriented for each face of the brush.

L. Duke 07-12-2010 11:17

Re: [Tutorial] Creating brush entities
 
Nice work! I played around with this once, but I was trying to rely on the bounds for the model I was using and never thought to change the min/max stuff.

flud 07-12-2010 21:39

Re: [Tutorial] Creating brush entities
 
try that, spawn model and get
PHP Code:

GetEntPropVector(modelProp_Send"m_vecMins",minbounds);
GetEntPropVector(modelProp_Send"m_vecMaxs",maxbounds); 

for me it work

alinayg 08-18-2010 19:11

Re: [Tutorial] Creating brush entities
 
Hey guys, I'm not much of a coder, but I was wondering how I could go about putting a brush entity, func_nobuild into a map? If anyone would like to help It would be greatly appreciated.

Thrawn2 08-25-2010 09:41

Re: [Tutorial] Creating brush entities
 
hmm, how do i rotate a trigger_push brush? rotating the entity with teleportentity changes the direction you are being pushed, but not the area.

blodia 08-25-2010 16:55

Re: [Tutorial] Creating brush entities
 
alinayg edit the code snippet in the first post to make a func_nobuild instead of trigger_push and remove the keyvalues. then you just need a way to trigger the code, you could use it on map start or admin/server command.

Thrawn the engine probably handles rotation for entities using the bounding box, i'm guessing since brushes wouldn't normally be using the bounding box they're not updated when the entity is rotated.

Thrawn2 08-25-2010 17:35

Re: [Tutorial] Creating brush entities
 
1 Attachment(s)
so i'd have to adapt the bounding box manually.
i'm assuming the minVec and maxVec are vectors pointing at two opposites corners of the cube.
i need to rotate those. because i dont want rotation along the z axis, i can reduce the problem to 2d.

i thought this should do the trick (read about it here).
it's pretty basic maths, but it doesnt work the way expected.
PHP Code:

stock RotateVector(Float:vector[3], Float:rotation) {
    new 
Float:rVector[3];
    
rVector vector;
    
rVector[0] = vector[0] * Cosine(rotation) - vector[1] * Sine(rotation);
    
rVector[1] = vector[0] * Sine(rotation) + vector[1] * Cosine(rotation);
    
vector rVector;


the results are not what they should be, instead of a rotated square i get "random" rectangles.
or no area at all, i guess thats because sometimes the minvec values are larger than the maxvec values.
i dont know - i'm stuck. i attached the test-plugin i'm using to debug this. it draws on the floor how the square should look like.

blodia 08-25-2010 18:45

Re: [Tutorial] Creating brush entities
 
i've been looking into this more, it seems m_nSolidType 2 is an axis-aligned bounding box so it can't be rotated, its aligned to the world axis and will normally grow/shrink to fit the model.

m_nSolidType 3 is an orientated bounding box which is what you need but looking in const.h of the sdk files it seems its not implemented.

http://developer.valvesoftware.com/wiki/Bounding_volume
http://developer.valvesoftware.com/wiki/Bounding_box

Thrawn2 08-26-2010 01:39

Re: [Tutorial] Creating brush entities
 
huhm, thanks for those infos, makes sense now. :up:
it seems SOLID_OBB isnt implemented, but SOLID_OBB_YAW is. and since i only want to rotate it around the z-axis this could work for me. i'll have a try.

EDIT:
SOLID_OBB puts an aligned square around the actual rotated bounding box.
SOLID_BBOX does not rotate at all.
SOLID_OBB_YAW does not work at all :cry:
http://thrawn.einfachonline.net/imag...6_08_03_37.jpg


All times are GMT -4. The time now is 04:49.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.