Your Ad Here

Subscribe
 Post #1
 6th June 2010 Last edited by haza55; 9th June 2010 at 08:25AM..
haza55's Avatar
October 2005
500 Posts

gm_queryphys

This module is a way of getting the vertexes of a physics object.



Functions

-- Returns the number of convexs.
PhysObj:GetConvexCount()

-- Returns a table of triangles.
PhysObj:GetConvexMesh(convexIndex)

-- Rebuilds a PhysObj with the provided convexes.
PhysObj:RebuildFromConvexs(position, angle, mass, damping, rotDamping, inertia, rotInertiaLimit, convexes)



 Post #2
 6th June 2010
bobthe2lol's Avatar
July 2007
900 Posts
Awesome!!!
 Post #3
 6th June 2010 Last edited by Tobba; 17th July 2010 at 08:29AM..
Tobba's Avatar
December 2008
2,032 Posts
Fucking awsome! now i can complete my bullet physics in source project!    or probbably not...   
 Post #4
 6th June 2010
Gold Member
maurits150's Avatar
February 2007
3,044 Posts
Fucking epic!
 Post #5
 6th June 2010
Grocel's Avatar
October 2008
385 Posts
Will this get shipped with gmod?
You posted about it in the gmod update threat.
 Post #6
 6th June 2010
Gold Member
CapsAdmin's Avatar
August 2005
6,549 Posts
You can use this with entity:PhysicsFromMesh(table) ?
 Post #7
 6th June 2010
haza55's Avatar
October 2005
500 Posts
Should work.

Edited:

I think as long as the object doesn't already have a physics object, you should be fine.
 Post #8
 7th June 2010
I_am_McLovin's Avatar
May 2009
39 Posts
Hey, I tried to use the phys:GetConvexCount() but crashed with the reason "Lua Error Dump!". Here is my code...

Code:
local physmeta = FindMetaTable( "PhysObj" )
		
if physmeta and physmeta.GetConvexMesh and physmeta.GetConvexCount then
    local phys = ent:GetPhysicsObject()
		
    if IsValid( phys ) then
        local count = phys:GetConvexCount()
        print( count )
    end
end
 Post #9
 7th June 2010
Amic's Avatar
July 2008
136 Posts
Whats possible usage for this module :box.
 Post #10
 9th June 2010 Last edited by haza55; 9th June 2010 at 05:08AM..
haza55's Avatar
October 2005
500 Posts
Well I hit a roadblock. The triangle's vertices are not coming out in the correct order. Thus the collision model's planes all have incorrect normals. And there is nothing I can really do about it...

Edit: Hurrr, Fixed. I'm a retard.

Edited:

Well I have a permanent weld tool working.
 Post #12
 9th June 2010
FluD's Avatar
February 2006
646 Posts
update smartsnap!!!
 Post #13
 9th June 2010 Last edited by ralle105; 9th June 2010 at 02:53PM..
Gold Member
Dennab
October 2005
2,258 Posts
Me likey!

Edited:

When Using :GetConvexMesh(0) on the head bone of humans (10) you get this error
Code:
attempt to index a nil value
 Post #14
 17th June 2010
Gold Member
dvondrake's Avatar
August 2006
3,791 Posts
Any plans for a Linux binary?
 Post #15
 18th June 2010
tomato3017's Avatar
April 2007
474 Posts
Is clientside prediction going to be written?
 Post #16
 18th June 2010
Gold Member
Mooee's Avatar
June 2008
2,161 Posts
I'm sorry, but my lack of knowlege (when it comes to modules) forces me to ask: where's the proper place to put these files?
 Post #17
 18th June 2010
haza55's Avatar
October 2005
500 Posts
place the .dll into garrysmod/garrysmod/lua/includes/modules/

Clientside is coming.
 Post #18
 18th June 2010
Gold Member
Kung Fu Jew's Avatar
November 2006
3,955 Posts
Say I throw this on my server. All clients reap the benefits while on it?

e.g. this tool will work without each client having to get it: http://www.garrysmod.org/downloads/?a=view&id=101535
 Post #19
 18th June 2010
Tobba's Avatar
December 2008
2,032 Posts
Yes, but probbably there will be messed up prediction etc
 Post #20
 18th June 2010
Gold Member
Mooee's Avatar
June 2008
2,161 Posts
1. Thank you very much, I now know how to install the physics module as well.
2. Damn you norton! (It just deleted the file because it deamed unsafe.)
 Post #21
 18th June 2010
Gold Member
Ldesu's Avatar
March 2008
2,140 Posts
norton!
Well there's your problem
 Post #22
 18th June 2010
Grocel's Avatar
October 2008
385 Posts
1. Thank you very much, I now know how to install the physics module as well.
2. Damn you norton! (It just deleted the file because it deamed unsafe.)
I have Norten Internet Security 2010 and it doesn't say it's unsafe, it's an error in your Internet Security. ;)
 Post #23
 19th June 2010
bobthe2lol's Avatar
July 2007
900 Posts
Wow these people with norton. Its the most bloated, worst antivirus sofware ever. Use avast or nod32 or w/e
 Post #24
 19th June 2010
Tobba's Avatar
December 2008
2,032 Posts
Norton? I stopped using that when it removed both shell32.dll and hal.dll becuse they was "unsafe"
 Post #25
 19th June 2010
Gold Member
Ldesu's Avatar
March 2008
2,140 Posts
A friend of mine had Norton and he switched anti virus when Norton told him explorer.exe was a virus
 Post #26
 19th June 2010
aleksandervii's Avatar
December 2009
10 Posts
Where do i put the files? I mean all of them...
 Post #27
 19th June 2010
|King Flawless|'s Avatar
February 2010
712 Posts
A friend of mine had Norton and he switched anti virus when Norton told him explorer.exe was a virus
Sounds like he was infected with a rootkit
 Post #28
 19th June 2010
nikomo's Avatar
September 2007
863 Posts
Sounds like he was infected with a rootkit
No, it sounds like a virus replaced explorer with its own version.
Norton can't detect rootkits for shit.
 Post #29
 20th June 2010
Gold Member
Dennab
October 2005
2,258 Posts
Where do i put the files? I mean all of them...
You should only download one file, the windows binary (dll) and you should put it in lua/includes/modules
 Post #30
 20th June 2010
Gold Member
Bletotum's Avatar
June 2008
2,470 Posts
Lets not take this thread in the direction of antivirus wars, take it to this link instead. Also read it's OP, useful.

http://www.facepunch.com/showthread.php?t=948262
 Post #31
 20th June 2010
RP-01's Avatar
December 2008
61 Posts
Really nice work!
Is it possible to implement a function to clip single bones? It would be really useful for goremods and such. :V
 Post #32
 21st June 2010
Gold Member
Robbis_1's Avatar
July 2005
3,932 Posts
This is great, but does anybody have a clue why it always crashes for me?
I tried something so simple like getting the convexes and then setting them again, but it crashes. And I'm trying it on props.
	local ent = Ply:GetEyeTrace().Entity
	local physObj = ent:GetPhysicsObject()
	
	physObj:EnableCollisions(false) -- I thought it was going to prevent the crash, but apparently not
	local convexes = physObj:GetConvexMesh(0)
	physObj:RebuildFromConvexs(physObj:GetPos(), physObj:GetAngle(), physObj:GetMass(), physObj:GetDamping(), physObj:GetRotDamping(), 1, 1, convexes)
	physObj:EnableCollisions(true)
 Post #33
 21st June 2010
haza55's Avatar
October 2005
500 Posts
local ent = Ply:GetEyeTrace().Entity  
local physObj = ent:GetPhysicsObject()  
  
physObj:EnableCollisions(false) -- I thought it was going to prevent the crash, but apparently not

local convexes = physObj:GetConvexMesh(0)

physObj:RebuildFromConvexs(physObj:GetPos(), physObj:GetAngle(), physObj:GetMass(), physObj:GetDamping(), physObj:GetRotDamping(), 1, 1, {convexes})

physObj = ent:GetPhysicsObject()
physObj:EnableCollisions(true)  
 Post #34
 21st June 2010
Gold Member
Robbis_1's Avatar
July 2005
3,932 Posts
Aah, the previous physobject becomes invalid so I need to fetch the new one I just created... And the convex table is a table of convexes for each bone. Thanks a lot, it works now!
 Post #35
 21st June 2010
haza55's Avatar
October 2005
500 Posts
No, bones are more than one PhysObj

A PhysObj can have more than one Convex, Each Convex is literally a convex shape made up of triangles. To make something concave, you need to use more than one convex.
 Post #36
 21st June 2010
Gold Member
Robbis_1's Avatar
July 2005
3,932 Posts
Ah, that's making more sense.

Edited:

Any idea what's causing the "slidyness" when you try to jump on it as a player? It works fine for props vs props, but player vs props is weird. This is in SP, but maybe it's related to prediction in some way?
 Post #37
 21st June 2010
Grocel's Avatar
October 2008
385 Posts
Ah, that's making more sense.

Edited:

Any idea what's causing the "slidyness" when you try to jump on it as a player? It works fine for props vs props, but player vs props is weird. This is in SP, but maybe it's related to prediction in some way?
That the reason why Haza is working on a client-side part of this module.
 Post #38
 21st June 2010
Gold Member
Zenreon117's Avatar
April 2008
2,336 Posts
how do I install this?
 Post #39
 22nd June 2010
MegaDeath's Avatar
August 2007
323 Posts
Best module ever, Garry needs to incorporate this like he did Jinto's code :D
 Post #40
 22nd June 2010 Last edited by nemomurder22; 22nd June 2010 at 03:09AM..
nemomurder22's Avatar
June 2010
92 Posts
How do we install this? There are multiple files and no info.txt so... Maybe Steam>Steamapps>garrysmod folder 1?


Reply

All times are GMT. The time now is 06:43AM.

Facepunch Studios 2010 - Server 'MARGE'