1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

GetBoneCords()

Discussion in 'Programming' started by mouserpg, Mar 28, 2005.

  1. mouserpg

    mouserpg New Member

    Joined:
    Mar 28, 2005
    Messages:
    8
    Likes Received:
    0
    How do I get the bone coordinates of a certain bone? I need to get the coordinates from the player's feet. I know how to get this if I were using the player mesh, but not if I am using a model without a bone.

    example:

    Code:
    var something lol;
    local [b]coords[/b] rofl;
    
    rofl = [b]GetBoneCoords('[/b]Bip01 L Foot[b]');[/b]
    lol = [b]Spawn(class'classtospawn', self,, rofl.origin);[/b]
    
    This should work for the players foot... if the mesh was being used by the file. Is there any way to call the player meshes so I can use the default bones? I need to bind something to the players feet, and this will be very helpful. Currently, if I use this code, the object will spawn over 500m away from me.

    Am I going about this all wrong?
     
  2. mouserpg

    mouserpg New Member

    Joined:
    Mar 28, 2005
    Messages:
    8
    Likes Received:
    0
    Let me try to explain this a little better:

    I'm trying to attach the surfboard to the player's feet, and the particle emitter at the very end of the surfboard. Currently, the particle emits slightly above the surfboard, and the surfboard doesn't bind to the players feet.

    [​IMG]

    That's what it looks like when you get the right angle, but I want it to have the right angle 24/7.
     
  3. meowcat

    meowcat take a chance

    Joined:
    Jun 7, 2001
    Messages:
    774
    Likes Received:
    1
    quick question: where does the surfing/flying physics take place? in the surf board or in the player?

    Most stuff that gets attached to anything else must have its collision variables modified. Take a look at the code in the pawn class (and inventory attachment class) for how third person weapon attachments are hooked up the player model. Also if there is no a bone to attach something to (as in the case of an actor that is rendered as a static mesh) you can use the 'setbase' function (http://udn.epicgames.com/Two/ActorFunctions#SetBase) after first placing the actor you want to attach in the correct position relative the actor it will be attached to.
     
  4. mouserpg

    mouserpg New Member

    Joined:
    Mar 28, 2005
    Messages:
    8
    Likes Received:
    0
    The surfing physics takes place in the surfboard classes. Thanks for the help, I'm gonna check it out. =)
     
  5. meowcat

    meowcat take a chance

    Joined:
    Jun 7, 2001
    Messages:
    774
    Likes Received:
    1
    So is the surfboard a subclass of vehicle? If so, you don't want to attach the surfboard to the player, you want to attach the player to the surfboard (there is a difference). There are several mods (Chaos Evolution and Colossians come to mind) that implement this type of vehicle. You may want to see how they went about doing it. But the basics will involve changing the KDriverEnter function to attach the player to the board (using setbase as opposed to attachtobone).
     
  6. mouserpg

    mouserpg New Member

    Joined:
    Mar 28, 2005
    Messages:
    8
    Likes Received:
    0
    It's not a vehicle, no.
     
  7. mouserpg

    mouserpg New Member

    Joined:
    Mar 28, 2005
    Messages:
    8
    Likes Received:
    0
    Hmm, I'm pretty much lost here. I still can't figure out how to attach it to the player's bone. Only a certain vect, which I'm currently using (it doesn't work right, btw).
     
  8. meowcat

    meowcat take a chance

    Joined:
    Jun 7, 2001
    Messages:
    774
    Likes Received:
    1
    I guess I should ask, since the board is not a vehicle, who actually does the movement and who follows. You said the physics takes place in the board, or is it that the board sets the controlling pawn's physics to something else, and the pawn does the actual movement(with the board following)? Also what class does the board derive from (this would be good to know to tell what its default properties might be)?

    on another note, where exactly do you call attachtobone ?
    If the board attaches itself to the player then you could simply place a line of code like:

    Surferpawn.AttachToBone( self, 'The_FootBoneName_YouWant');

    in the surfboard class. of course you need to set the rotation of the board as well (maybe by using SetRelativeRotation). As long as you know that a bone by that name exists in the player mesh skeleton, you should be OK.
     
  9. mouserpg

    mouserpg New Member

    Joined:
    Mar 28, 2005
    Messages:
    8
    Likes Received:
    0
    That still doesn't work. I still need to get the bone coordinates to update it. :(

    EDIT: Here, this is what I'm currently using


    rofl = Spawn(class'traileffect', self);
    rofl.SetBase(self);

    If I used getbonecoords, I could add var.origin to it, and it should snap. Otherwise, I'd have to add bones to my meshes, but I have no clue on how to do that.
     
    Last edited: Mar 28, 2005
  10. meowcat

    meowcat take a chance

    Joined:
    Jun 7, 2001
    Messages:
    774
    Likes Received:
    1
    hmm... so does it spawn in the right location but does not stay there, or does it just not spawn or attach at all? You might want to log the the location that the board is spawning at to see if it is even getting the coordinates of the bone
     
  11. mouserpg

    mouserpg New Member

    Joined:
    Mar 28, 2005
    Messages:
    8
    Likes Received:
    0
    I tried logging it, but it showed up as: 0.0,0.0,0.0 every time. So it's not getting the coordinates of it.

    EDIT: It doesn't spawn in the right location. But it does stay there. Right now I'm not using GetBoneCoords();. The trail emitter is directly above the surfboard, and it stays there no matter what.
     
    Last edited: Mar 28, 2005
  12. meowcat

    meowcat take a chance

    Joined:
    Jun 7, 2001
    Messages:
    774
    Likes Received:
    1
    So where are you calling get GetBoneCoords? in the board or in the pawn? You probably already know this, but if you are calling it from the board you need to get a reference to the pawn (call it SurferPawn for instance), then have the line something like you had before:
    Code:
    local coords rofl;
    rofl = Surferpawn.GetBoneCoords('Bip01 L Foot');
    
    // or how about
    rofl = Surferpawn.GetBoneCoords('lfoot');
    
    If that is what you are already doing then you might have to check the spelling of the bone name. If that fails i don't know what else to suggest.

    [EDIT] You know I seem to recall that the naming conventions with spaces were not always accepted by some of the functions. Just to try all possibillities, instead of 'Bip01 L Foot' try 'lfoot' instead. lfoot is one of the attach aliases for the base UT2Kx skeletons ).
     
    Last edited: Mar 28, 2005

Share This Page