Getting Ragdoll bone vectors/angles

Hi guys,

Does anyone know how to find the location of a ragdoll’s bone vectors/angles? I’m editing a SWEP and can’t seem to find a way to locate these.

Cheers

Entity:GetBonePosition( 1 )

It returns two values, you’d use them like this:


local vPos, aAng = Entity:GetBonePosition( 1 );

Thanks!

But how? like do I put that in console? do I make a LUA file?

No you’d put it in your SWEP.

Hi,

Tried to do this into a swep but didn’t work, could someone assist?

Sure we can
Show us what you tried


AddCSLuaFile()
SWEP.Base = "weapon_base"
SWEP.PrintName		= "fire_admin_tool"
SWEP.Slot		                   = 1
SWEP.SlotPos		= 3		
SWEP.DrawAmmo		= false				
SWEP.DrawCrosshair		= true		
SWEP.ViewModel		= "models/weapons/v_pistol.mdl"	
SWEP.WorldModel		= "models/weapons/w_pistol.mdl"	
SWEP.ReloadSound		= "Weapon_357.Reload"	
SWEP.HoldType		= "pistol"			
-- Other settings
SWEP.Weight		= 1			
SWEP.AutoSwitchTo		= false			
SWEP.Spawnable		= true		
 
-- Weapon info
SWEP.Author		= ""		
SWEP.Contact		= ""		
SWEP.Purpose		= "For admin use with DarkRP Fire System (Coder Hire)"	
SWEP.Instructions	= "Left click: Start Fire, Right click: Remove ALL Fires"		

-- Primary fire settings
SWEP.Primary.Sound			= "Weapon_StunStick.Swing"	
SWEP.Primary.Automatic		= 1	
SWEP.Primary.Ammo		= "Pistol"	
SWEP.Category 			= "Weapons"

function SWEP:Initialize()			
end

function SWEP:PrimaryAttack()		
	if ( !self:CanPrimaryAttack() ) then return end		
	Entity:GetBonePosition( 1 )	
end

No offense but if you don’t even know where to insert code or how to make an Lua file, you should at least take a few weeks break and actually learn Lua instead of diving into it and causing yourself frustration and making stupid/dumb/pointless questions that even a beginner doesn’t have to ask.

Trust me, I pulled this kind of shit on another programming language. Actually learning the language helps me understand a lot on what the fuck I’m doing.

[editline]21st February 2014[/editline]

And AddCSLuaFile() should at least contain a string pointing to a file name

When AddCSLuaFile( ) is empty, ie without arguments, it will send the file that it is in to the client.

You don’t have to rate someone dumb because they didn’t know something, I’ve talked to a ton of a scripters that wasn’t even aware that when it had to arguments it at the file it was in to the client.

Thanks for your response, albiet typical.

I don’t have time to learn LUA nor do I want to learn it, I simply have one small issue “getting rag doll bone locations” for something else i’m working on.

As the dev of the original addon was unable to confirm how to do this, I come here instead.

Also if 3 major devs within the gmod/darkrp community can’t work it out, how can I work it out from just learning a bit of LUA.

I suggest you turn on your uber skill god mode lua skills and post up the full working SWEP/Solution then huh?

“Major devs” I laughed.
If they can’t use the wiki and know about this function, they’re far from being developers at all!

You can learn it using the language really. You won’t ask “where does it go?”

It’s like someone giving you a complete class in C#, only to ask where you put it. “In a .txt? In …?”

[editline]21st February 2014[/editline]

As someone said, the function is ENTITY/GetBonePosition which returns the position and angle.

[editline]21st February 2014[/editline]

Judging from what you did, you don’t know jack shit about lua, so even knowing about this function, you can’t and won’t be able to implement it properly. You’re just wasting your time diving with 0 knowledge in programming or coding, into something that requires a decent knowledge of it.

I’m completely clueless and did not see this. Thanks, though.

Hence my OP… i’m simply trying to get the angle/vec of ragdoll bones and the DarkRP author told me to add a few lines of code into a SWEP…

So I came here to ask for help. Look this is a forum, if you can help then please do post a solution or direct me to a place I can read up on this (if applicable which you have pointed out isn’t) otherwise don’t post.

The world needs less rubberneckers in forums, dropping in to say “LOL IDIOT” then going out.

??? We posted a solution. It’s your fault if you’re too dumb to use it.

Nice… call someone dumb when they simply don’t know something. I’m glad when you started coding you got everything you ever needed to know from thin air mate…

Posting a line of code and calling that a solution is like asking a mechanic “why does my car not start” and them telling you “because a hose is missing”

Great… now how can I make it start… what part, how do I remove the old one/put new one on.

I didn’t ask for the code, I asked how can I capture them.

Just piss off if you don’t want to help.

EDIT: wow you even do it yourself… http://forum.facepunch.com/showthread.php?t=1296406 see if people were not dicks online, the world would be moving forward in all aspects of life.

Mate the first post was literally the be-all end-all answer to your question. You asked how to find the bone position and angle for a bone and he posted the code. Nobody knows what more you want, and the swep code you posted doesnt even hint at anything other than that you took a template swep and pasted the function the first post gave you.

[editline]24th February 2014[/editline]

Like a better analogy would be the customer saying “I need a 10cm long Phillips head screw”, and when the mechanic gives the customer that piece, the customer says “awesome! do I put it in the glove compartment? wedge it in the steering wheel?”. The mechanic then asks why you ordered the screw and the customer shows the mechanic his TV, which has the screw nailed into it, and demands to know why the mechanic is so useless.

You’re dumb since they spoon-fed you what you needed to do and told you what to do but you refused to do it and wanted somebody to hold your hand the whole way through. There’s also a massive wiki (two of them actually) waiting to be read for about two minutes so you’d know exactly what to do. It’s okay to be ignorant, but not when you force yourself to be ignorant-- that’s called being dumb.

Not really, you’re trying to give extra functionality rather than debug, so it’s more like them giving you a computer fan and expecting you to figure out how to shove it into your computer.

He asked for help, yeah, everybody does. The difference is he wasn’t stupid nor a dick about it.

The funniest thing about this, is that if you weren’t an complete dick about all of this, you would have been done and moved forwards already.

But hey, if you’re a self-satisfied over nothing, self-righteous shit-stain nothing we do is going to help. You’re chasing a bus that has long departed, the answer was already given and you’re still asking for more.

Fix your attitude then maybe others will fix your shit (even though they already did).

Better yet, stop posting and just piss off if you don’t want to accept the help they’ve already given you.

I asked for help when everything I tried didn’t work, asking if other fellow coders figured out a solution to it. Seems like there weren’t an I stopped posting.

It’s different from asking a question in a topic you have 0 knowledge about.

So I don’t get why you’re crying and saying I’m a hypocrite.

[editline]24th February 2014[/editline]

That analogy was golden.

Apologies, I do know my replies are “shit” I just find after going down various roads for help and getting the same (to someone who doesn’t know any code) what feels like 10% of the solution hard. Noting everwhere else I get help for various things you get not only the answer, but a bit of additional suggestion in how one would use it.

E.g the code is this, so when you go in game, point at XYZ and type that into console or however it’s used.

It eats at me because when people need help on something I know how to do, I ensure the person not only knows how to do it but to show them examples of what they would do.

Maybe I’m just reading replies in a negative tone and taking it as unhelpful.

All I was wanting to know, is if I setup a rag doll standing on a map in a certain position, how do you capture their bone vectors and angles, not only the code for this but how would one use this? Type in console or whatever, so that I can list them out like the below example:

local rag1Pos = {

Vector( 0, 0, 0 ),
Vector( 0, 0, 0 ),
Vector( 0, 0, 0 ),