UE3 - UDK Change player location based on position data

  • 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.

silverwizard

New Member
Mar 13, 2013
8
0
0
Continuing where I left off in my other topic, I have a position and rotation tracker and I would like to use it as an input device for the player's rotation and location. As far as rotation is concerned, I have encountered no problems apart from a slight lagging, which disappears entirely when I am using only two dimensions (I can live without "Roll" for this one).

I have set the rotation in the PlayerTick function of the PlayerController class. I am using DLLBind to get the data from the tracker. The data does come in, I can log it and it shows in the log. However, when I use the SetLocation function, the player's location does not change. I have also tried to use the same function in the Pawn class, but to no avail.

Code:
function PlayerTick(float DeltaTime)
{
    super.PlayerTick(DeltaTime);
    SetRotation(RotateXYZ()); // This works
    SetLocation(TranslateXYZ()); // This doesn't
}
Any ideas?
 

Nathaniel3W

Member
Nov 11, 2012
48
0
6
There's a lot of stuff in your PlayerController's PlayerTick function that you don't want to leave out. If you try writing your own code for moving, then you'll have to re-invent the wheel with not only just moving, but also realistic acceleration, animation, collision, falling, swimming, and a lot of other stuff. I recommend that you try moving using the code that's already in PlayerController.PlayerTick.

Open up PlayerController.uc, copy all of its PlayerTick function into your PlayerTick function, and add your code into that. In there somewhere there's some code for walking. Modify that with the data you get from your tracker.
 

Nathaniel3W

Member
Nov 11, 2012
48
0
6
It sounds like you've already gotten to where you need to be, but I just wanted to add here that the code you're most likely to want to change is in your PlayerController's PlayerWalking state and UpdateRotation function.