Results 1 to 21 of 21
  1. #1
    Iron Guard
    Join Date
    Feb 2010
    Location
    Iran, Tehran
    Posts
    714

    Default MoveTo Exact Location

    hi every one.
    about MoveTo, suppose i have a pawn and a destination point like below:


    when i order my pawn to move to destination using MoveTo() function, result is like this:


    but i want him/her to move exactly to that location. like this:


    as you see, setting DestinationOffset to zero didn't help either:

    Code:
    MoveTo(target.Location, target, 0);
    any ideas?
    thanx
    Lead Programmer At Bazi Resaneh Game Studio


  2. #2
    Iron Guard
    Join Date
    Feb 2010
    Location
    Iran, Tehran
    Posts
    714

    Default

    guys?? help please
    Lead Programmer At Bazi Resaneh Game Studio


  3. #3

    Default

    if you load the mesh for your pawn into the level as a skeletal mesh, or whatever kind of mesh you are using for pawn, is the origin of the mesh at the center?

    what mesh are you using for pawn?

    you might have to recenter the root/origin of your skeletalmesh,or whatever kind of mesh you are using



    Rama

  4. #4
    Iron Guard
    Join Date
    Feb 2010
    Location
    Iran, Tehran
    Posts
    714

    Default

    i don't think that's the problem. my mesh's origin is in the zero point.
    you mean moveto exactly moves pawn's origin to the specified point? i don't think so.
    Lead Programmer At Bazi Resaneh Game Studio


  5. #5
    Redeemer
    Join Date
    May 2012
    Location
    Barcelona
    Posts
    1,559

    Default

    It probably depends of the root bone ,
    try to spawn a little Sphere on your char , "location" then you will know what

  6. #6
    Iron Guard
    Join Date
    Feb 2010
    Location
    Iran, Tehran
    Posts
    714

    Default

    i can't test that till tomorrow, but i'm sure that root bone's location is zero point.
    anyway i'll test that and let you know the result
    Lead Programmer At Bazi Resaneh Game Studio


  7. #7
    Redeemer
    Join Date
    May 2012
    Location
    Barcelona
    Posts
    1,559

    Default

    Ok that will be useful for me aswell thank you

  8. #8

    Default

    well if the moveTo is stopping when your pawn's bounds intersect destination point

    you can just get the bounds of your pawn and then adjust the destination point based on that.

    this could should be useful

    Code:
    var vector pawnExtent;
    
    function getBounds(){
      local box boundingBox;
    	
      yourpawn.GetComponentsBoundingBox(boundingBox);
      pawnExtent.x = (boundingBox.max.x - boundingBox.min.x - 2) / 2;
      pawnExtent.y = (boundingBox.max.y - boundingBox.min.y - 2) / 2;
      pawnExtent.z = (boundingBox.max.z - boundingBox.min.z - 2) / 2;
    }
    the minus 2 is necessary because the Epic algorithm adds 2 to ensure the box is visible if used with drawdebugbox

    pawnExtent now tells you the x width y width and z height of your pawns components

    so you can subtract/add these values from your destination point to offset for the shape of the pawn.



    Rama

    PS: using bounding cylinder is also an option
    http://wiki.beyondunreal.com/UE3:Act...undingCylinder

  9. #9
    Iron Guard
    Join Date
    Feb 2010
    Location
    Iran, Tehran
    Posts
    714

    Default

    cool! allright, i'll give it a try to see if it works. thanx
    Lead Programmer At Bazi Resaneh Game Studio


  10. #10

    Default

    let me and everyone know if that works for you!

    This seems like a question others will/have had!



    Rama

  11. #11
    Iron Guard
    Join Date
    Feb 2010
    Location
    Iran, Tehran
    Posts
    714

    Default

    Quote Originally Posted by Neongho View Post
    try to spawn a little Sphere on your char , "location" then you will know what
    i spawned that sphere, my pawn's location and the destination don't match together.
    Lead Programmer At Bazi Resaneh Game Studio


  12. #12
    Iron Guard
    Join Date
    Feb 2010
    Location
    Iran, Tehran
    Posts
    714

    Default

    Quote Originally Posted by evernewjoy View Post
    well if the moveTo is stopping when your pawn's bounds intersect destination point

    you can just get the bounds of your pawn and then adjust the destination point based on that.

    this could should be useful

    [CODE]
    pawnExtent now tells you the x width y width and z height of your pawns components
    you can subtract/add these values from your destination point to offset for the shape of the pawn.
    i tried that too. didn't help. is that working correctly for you? maybe i'm doing something wrong in implementation.
    Last edited by donamin; 09-09-2012 at 01:53 AM. Reason: :P
    Lead Programmer At Bazi Resaneh Game Studio


  13. #13
    Boomshot
    Join Date
    Aug 2011
    Posts
    2,286

    Default

    Code:
    MoveTo(target.Location, target, 0);
    The simple answer may be that the target is blocking the pawn.

    If not, and assuming the final location is being offset by the radius of the collision cylinder as shown in the diagram...

    Code:
    MoveTo(target.Location + Normal(target.Location - Location) * CollisionComponent.CollisionRadius, target);
    ... but this feels like a hack. I would check there's nothing blocking the pawn, disable collision on the target, or try moving it to an open location not based on an actor.

  14. #14
    Iron Guard
    Join Date
    Feb 2010
    Location
    Iran, Tehran
    Posts
    714

    Default

    @Spoof
    yes, i was thinking about your way too. but i'm sure that nothing is blocking my pawn. target has no collision at all.
    Lead Programmer At Bazi Resaneh Game Studio


  15. #15
    Redeemer
    Join Date
    Jan 2004
    Location
    The great Pacific Northwest
    Posts
    1,428

    Default

    The native code for moveTo (at least for UEngine 2.x) always returned for me when the goal target point was within the pawn's collision cylinder OR the internal MoveTimer 'popped' (e.g. counted down to less than zero). The only way I was able to get "exact" movement to a specific vector point was to manually call 'Pawn.Move' in 'Tick' (either the Controller's tick, or the pawn's) with a Delta Move Vector calculated from the DeltaTime, velocity and acceleration. I would also check to see if the Delta Move Vector was greater then the remaining distance, if it was I set the remaining distance vector as the Delta Move Vector and then 'popped' out of the custom manual movement state.
    "What do you mean it doesn't exist clientside?"
    YARM: where player's Lean, Prone, Mantle, Dash, Crouch Jump, 'Parkour' and slide around all with generic realistic weapons!
    My Generic Mods for UT2K4:
    Yet Another Real-life Mod: Realistic weapons, unoriginal gameplay, w/ cheap CODMW knockoff mutator
    TD Vehicles: HUMV, MI4Hound, Motorcycle, IFAV Jeep, UH-60, MH-53 & AH-6 Helicopters, Abrams Tank

  16. #16
    Iron Guard
    Join Date
    Feb 2010
    Location
    Iran, Tehran
    Posts
    714

    Default

    thankx meowcat, i'll try that.
    Lead Programmer At Bazi Resaneh Game Studio


  17. #17
    Iron Guard
    Join Date
    Feb 2010
    Location
    Iran, Tehran
    Posts
    714

    Default

    @meowcat

    i tried that, but that made no difference, i put this code in my Tick() event:

    Code:
    Move((Target.Location - Pawn.Location) * VSize(Acceleration) * VSize(Velocity));
    any ideas?
    Lead Programmer At Bazi Resaneh Game Studio


  18. #18
    MSgt. Shooter Person
    Join Date
    Jun 2012
    Posts
    63

    Default

    I was having a similar issue, needed a pawn to reset itself on a podium and I ended up just setting its position and desired rotation after the moveto was completed. He slides a little but with the rotation animation playing it is not that noticeable. I am surprised Spoof's 'hack' method didn't work. Doesn't seem like a hack to me at all and should accomplish the task, I may even switch mine to that and let you know if I have any luck.

  19. #19
    Iron Guard
    Join Date
    Feb 2010
    Location
    Iran, Tehran
    Posts
    714

    Default

    don't know, maybe i'm doing something wrong. allright, i'll check that again. thanx
    Lead Programmer At Bazi Resaneh Game Studio


  20. #20
    Redeemer
    Join Date
    Jan 2004
    Location
    The great Pacific Northwest
    Posts
    1,428

    Default

    Here is some pseudo code (mostly untested, but just to show the general idea):

    Code:
    // this assumes that the Physics is something like PHYS_Flying, or maybe even PHYS_None,
    // that the target location is stored in a vector called VTarget, and that this code is in your pawn class
    function tick(float DT){
        local vector DeltaMove;
        local float fTargetDist;
        
        DeltaMove = Velocity*DT + Acceleration*DT*DT; // this also assumes that you are properly updating the velocity vector somehow and that this is pointing at your target for movement
        fTargetDist = VSize(VTarget - location);
        if( VSize(VTarget - (location + DeltaMove)) > fTargetDist)
              DeltaMove = Normal(DeltaMove) * fTargetDist;
        MoveSmooth(DeltaMove);
    }
    "What do you mean it doesn't exist clientside?"
    YARM: where player's Lean, Prone, Mantle, Dash, Crouch Jump, 'Parkour' and slide around all with generic realistic weapons!
    My Generic Mods for UT2K4:
    Yet Another Real-life Mod: Realistic weapons, unoriginal gameplay, w/ cheap CODMW knockoff mutator
    TD Vehicles: HUMV, MI4Hound, Motorcycle, IFAV Jeep, UH-60, MH-53 & AH-6 Helicopters, Abrams Tank

  21. #21

    Default

    Hi all, had the same problem and found this solution.
    Seems to be working for me way better than moveTo()

    Code:
    function tick(float DeltaTime) {
        local float DistanceToStopLocation;
        local vector DeltaVelocity;
    
        if (!bAtStopLocation) {//global var that we use to limit when this runs
    	DistanceToStopLocation = VSize(StopLocation - Location );
    	DeltaVelocity = (StopLocation - Location) / DeltaTime;
    	if (DistanceToStopLocation <= 1) {//target precision
    		bAtStopLocation = true;
    		Velocity *= 0;
    	} else if (DistanceToStopLocation <= 70 ) {//bounds so we only do this if at a certain distance, optional			
    		if( Abs(Vsize(DeltaMove)) > GroundSpeed) DeltaMove = Normal(DeltaMove) * GroundSpeed;
    		Velocity = DeltaMove;
    	}
        }
    }
    Last edited by Phenicks; 11-02-2012 at 09:58 AM.


 

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.