View unanswered posts | View active topics It is currently Thu Mar 28, 2024 3:03 pm



Reply to topic  [ 6 posts ] 
 Need to get a pointer to an AHuman's feet. 
Author Message

Joined: Fri Dec 30, 2011 3:33 am
Posts: 276
Reply with quote
Post Need to get a pointer to an AHuman's feet.
Sorry if this seems obvious, but it's non-obvious over here and I was hoping somebody would help me out.

How do I get the pointer to the Attachable foot objects on AHumans reliably? I just need to do this during Create(). I'm a little fuzzy about how one iterates through an AHuman to find objects in general, but in this case I need that specific pointer so that I can do some physics stuff to fix an issue in my mod :-)


Sat Jul 14, 2012 3:20 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post Re: Need to get a pointer to an AHuman's feet.
You'd only be able to get a pointer to them if they're GetsHitByMOs = 1. What you'd do is simply iterating through all MOs and checking to see if their RootIDs match your actor, and a PresetName check to see if they're the specific foot.


Wed Jul 18, 2012 8:14 am
Profile

Joined: Fri Dec 30, 2011 3:33 am
Posts: 276
Reply with quote
Post Re: Need to get a pointer to an AHuman's feet.
Ah. I can shut off that property after I've found it, though?

Or will that be read-only with an Attachment datatype that isn't a HeldDevice?

I'll test it when I get home, just wanted to know in advance if there were any other issues I'll have to work around :-)


Sun Jul 22, 2012 3:41 pm
Profile

Joined: Fri Dec 30, 2011 3:33 am
Posts: 276
Reply with quote
Post Re: Need to get a pointer to an AHuman's feet.
Well, so much for this being straightforward, lol.

Here's my script searching all the MOs for the feet:

Code:
         for i = 1, MovableMan:GetMOIDCount()-1 do
            local mo = ToMovableObject(MovableMan:GetMOFromID(i));
            print(mo.PresetName)
            if mo.RootID ~= nil then
               if mo.RootID == self.ID and string.find(mo.PresetName,"Foot FG",1,true) then
                  self.footFG = mo;
                  print("footFG = "..mo)
               end
               if mo.RootID == self.ID and string.find(mo.PresetName,"Foot BG",1,true) then
                  self.footBG = mo;
                  print("footBG = "..mo)
               end   
            end
         end   


Here are the values in the INI:

Code:
AddActor = Attachable
   PresetName = Dummy Foot FG A
   Mass = 5
   HitsMOs = 1
   GetsHitByMOs = 1

...yet the PresetName isn't printed. Legs, arms, helmets, guns... no feet. I guess that they're "invisible" since the Atomgroup's what really does stuff. I don't suppose I can use an Attachable there instead and... heck, I'll just try it and see...


Mon Jul 23, 2012 4:21 am
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post Re: Need to get a pointer to an AHuman's feet.
Should probably have posted this before you wasted your time but yeah, I can confirm that you can't find them like that. When you first put up this thread I tried the exact same thing and got the same result. I guess they're not attachables, I can only assume your theory is right.


Mon Jul 23, 2012 5:33 am
Profile

Joined: Fri Dec 30, 2011 3:33 am
Posts: 276
Reply with quote
Post Re: Need to get a pointer to an AHuman's feet.
Feet are AtomGroups.

The reference to the visual foot is some special feature of the AHuman Leg, which is a non-standard Attachable.

AtomGroups' exposure to Lua isn't documented, if it exists at all.

But the foot AtomGroup is in charge of leg extension, instead of the other way around, so if we change RotAngles of legs, they're offset from the foot bitmaps... that are supposedly Attached to them but in fact have no Lua-accessible pointers so far as I can tell.

In fact, the Foot section can be removed, getting rid of the visual foot, without crashing or causing any other issues. But if you remove the AtomGroup or name an Attachable datatype, crashy-crashy, because the engine expects an AtomGroup.

The only thing I haven't tested is whether AtomGroups are allowed to have a representative bitmap; guessing no. Not that matters, because I still can't get a pointer to them, rotate them, whatever.

Really unsure why it works this way :???:


Mon Jul 23, 2012 6:42 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.354s | 15 Queries | GZIP : Off ]