• Brush entitys ent:GetPos()
    13 replies, posted
hey, normaly you should use ent:GetPos() but as it seems, when i use it at brush based entitys, it dont work it returns vector(0,0,0 hammer: made brush whit trigger matrial, then tie to entity and then enterred my entity name. it works since perfecly, but now i need to get the pos of that entity, else i would need to make an keyvalue wich contains the text x y z but to do that in 17 maps for about 10-40 entitiys, a BIT hard. and there should be an easy way any one know this? EDIT: to hard i guess?
Try this: [lua]local min, max = ent:WorldSpaceAABB() local pos = (min+max)/2[/lua]
sorry for the bumb, but i still cant get it to work :( halp?
[QUOTE=bromvlieg;17843330]sorry for the bumb, but i still cant get it to work :( halp?[/QUOTE] What are you trying to do exactly?
to get the pos of an entity. info: its a brush hammer > placed a box whit trigger matrial> tie to entity > called it info_test_ent lua > ent:GetPos() returns vector(0,0,0)
[QUOTE=_Kilburn;17723980]Try this: [lua]local min, max = ent:WorldSpaceAABB() local pos = (min+max)/2[/lua][/QUOTE] Did you try this?
[QUOTE=_Kilburn;17723980]Try this: [lua]local min, max = ent:WorldSpaceAABB() local pos = (min+max)/2[/lua][/QUOTE] This is correct. But I advise against division, multiplication is faster. [lua] local mins, maxs = ent:WorldSpaceAABB(); local pos = ( mins + maxs ) * 0.5; [/lua]
i tryed that, and lol! it must be faster about 0.00000000000001 second?XD
[QUOTE=Jinto;17860879]But I advise against division, multiplication is faster.[/QUOTE] Oh, never really paid attention to that, but now that you say it, it's pretty obvious. :v: Thanks for the tip.
still no solusion :( *bump*
Does info_test_ent exist? Do you have red text in console saying it doesn't exist? GetPos is valid on any ent.
[QUOTE=Disseminate;17918332]Does info_test_ent exist? Do you have red text in console saying it doesn't exist? GetPos is valid on any ent.[/QUOTE] Read the OP again, he said it returns 0,0,0.
What does the WorldSpaceAABB solution return? You should be a bit clearer, does it still return 0,0,0 or what? Because it always worked for me.
it returns 0,0,0 also, and the ent name i just tyoped in something random, it real ent exists. after trying it for a while, its about random what the obbspace thngy returns, 0,0,0 or the good pos its totaly random, tryed to remake my hole dedi server, tryed t in my GMod else said. my pc is fucked XD wel, thanks any way for your time guys.
Sorry, you need to Log In to post a reply to this thread.