Data Realms Fan Forums http://45.55.195.193/ |
|
Need to get a pointer to an AHuman's feet. http://45.55.195.193/viewtopic.php?f=73&t=31440 |
Page 1 of 1 |
Author: | xenoargh [ Sat Jul 14, 2012 3:20 am ] |
Post subject: | 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 |
Author: | CaveCricket48 [ Wed Jul 18, 2012 8:14 am ] |
Post subject: | 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. |
Author: | xenoargh [ Sun Jul 22, 2012 3:41 pm ] |
Post subject: | 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 |
Author: | xenoargh [ Mon Jul 23, 2012 4:21 am ] |
Post subject: | 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... |
Author: | Bad Boy [ Mon Jul 23, 2012 5:33 am ] |
Post subject: | 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. |
Author: | xenoargh [ Mon Jul 23, 2012 6:42 am ] |
Post subject: | 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 |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |