Results 1 to 7 of 7
  1. #1

    Default Bone location for AddForce and AddImpulse

    For the AddForce and AddImpulse functions I noticed a bone name and a vector location value could be specified. According to the documentation a value of 0,0,0 for the location and a specified bone name will apply the force at the center of mass of that bone.

    My question is, if I specify a location vector other than 0,0,0, will that value be relative to the center of mass or will it be relative to the world?

    Specifically, I would like to apply an impulse or force to the ends or joint locations of a bone.
    So, if the bone I had named was 4 units long, could I specify 2,0,0 to describe a location at one end of the bone. (I am assuming that if the location value is relative, then the length of the bone is always along the x axis)

    Of course, I would also need to know the actual length of a bone, and I have not been able to find a way to do that yet either.

    Anyone have any experience with manually specifying the location on a bone?

  2. #2

    Default

    Bump! I alsow whant to know this, anyone with any idea?

  3. #3

    Default

    Couple clarifications:

    1. The two parameters don't work with each other. The bone name is if it's a SkeletalMeshComponent, and only applies force to that bone. Regardless of whether you specify a bone name, the position is still the COM of the object, not the bone.
    2. Position is relative to world. In code: "@param Position Point in world space to apply impulse at."

    So in this case yes you would need to manually find the socket location. So, make sure you have a socket at that joint specified, then use this func:

    Code:
    native final function bool GetSocketWorldLocationAndRotation ( name InSocketName, out vector OutLocation, optional out rotator OutRotation, optional int Space )
    You can then use OutLocation to specify the location vector in the addforce/impulse.
    Try my game Never End, now on the App Store! For more info, see the release thread.

    My Blog: WillyG Productions - Your Premiere UDK Resource
    My YouTube Channel: WillyG Productions
    My Facebook Page: WillyG Productions

  4. #4

    Default

    Okay, thanks for that. But it still does not make any sense how it behaves, look at the following code:

    Code:
        local vector spineY;
    
        spineY = SkeletalMesh.GetBoneAxis('spine_4_joint', AXIS_Y);
    
        SkeletalMesh.AddImpulse(vect(0,0,20), SkeletalMesh.GetBoneLocation('spine_4_joint') + (spineY * 100), 'spine_4_joint');
    
        DrawDebugLine(SkeletalMesh.GetBoneLocation('spine_4_joint'), SkeletalMesh.GetBoneLocation('spine_4_joint') + (spineY * 100), 255, 255, 255);
    Isn't that suppose to make the mesh sort of hang in the white line because the impulse is applied at the end of that line?

    Why does it look like this when it finds it's balance?


  5. #5

    Default

    I'm not sure why you're still trying to get the bone axis/location and use that to find the bone's end. It's much easier to make a socket at the bone's end and use GetSocketWorldLocationAndRotation().

    As for the weird behavior, I think it's because you're still adding impulse to the whole pawn. Since the bone is likely off the pawn's COM it won't go perfectly down the line but have some angle to it, so it won't be balanced.
    Try my game Never End, now on the App Store! For more info, see the release thread.

    My Blog: WillyG Productions - Your Premiere UDK Resource
    My YouTube Channel: WillyG Productions
    My Facebook Page: WillyG Productions

  6. #6

    Default

    Quote Originally Posted by willyg302 View Post
    I'm not sure why you're still trying to get the bone axis/location and use that to find the bone's end. It's much easier to make a socket at the bone's end and use GetSocketWorldLocationAndRotation().

    As for the weird behavior, I think it's because you're still adding impulse to the whole pawn. Since the bone is likely off the pawn's COM it won't go perfectly down the line but have some angle to it, so it won't be balanced.
    The thing is that I want to apply all my force on one point but from different point of attack. I want to make it like the forces is applied at different points on the character (like at the foots or wrists), but the forces need to be at the same place all the time, so i can't apply the force on the different bones because those will be animated.

    And as for the sockets, if getBoneLocation don't work, I will have to use sockets, but i have no use for them otherwise. No weapon or anything like that in the game...

  7. #7

    Default

    Even if you have no other use for them....you should still use sockets. I mean, it's the easiest way to do it and takes like a minute to set up in-editor. For the thing you're describing sockets should do the job fine.
    Try my game Never End, now on the App Store! For more info, see the release thread.

    My Blog: WillyG Productions - Your Premiere UDK Resource
    My YouTube Channel: WillyG Productions
    My Facebook Page: WillyG Productions


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.