Sunday, January 30, 2011

UDK-AutoTurret

follow by: http://udn.epicgames.com/Three/MasteringUnrealScriptStates.html


But there have some problem:

1.it can't rotate correctly

2.it shot wrong side

Solution:
http://forums.epicgames.com/showthread.php?t=717876&highlight=Turret&page=3

In  #28 Poster Said :


Step 1: Open the Editor and fully load the "TurretContent.upk" package, there should be 4 assets in it (at the time of this posting, the package contains: TurretAnims, TurretAnimTree, TurretMesh, and TurretMesh_Physics)

Step 2: Double-click on the "TurretMesh" asset in the TurretContent package to open the Animset Editor for the turret. As you can see, by default, the turret is pointing in the negative X direction which is clearly wrong because in Unreal, unrotated objects are supposed to point down the positive x axis. To compensate for this error in the turretmesh, inside the Animset Editor, look for the "Mesh" tab in the Properties window. Underneath the "SkeletalMesh" category, expand "RotOrigin" and set the Yaw value to 180 degrees. Your turret mesh should now point down the positive X axis like a proper Unreal asset . You can close the Animset editor now. This fixes the first problem with the provided turret.

Step 3: The second issue with the turret is that its bone pivots are all off. To compensate for this, inside the TurretContent package, double-click on the TurretAnimTree asset to open the AnimTree Editor. Once open, click on the green "SkelControlSingleBone: PivotController" box to bring up its properties on the bottom. Under the "Rotation" category, you should see an empty checkbox next to "bAddRotation"; however, you want this to be trueso put a check mark next to "bAddRotation". Secondly, by default, the BoneRotationSpace property just below the check box is set to "BCS_BoneSpace" by default, but this is no good because the bone pivots are all messed up. Therefore, we need to change this to "BCS_ActorSpace" instead to get what we want. Make sure you're setting this under the "Rotation" category, NOT the "Translation" category. You can close the AnimTree Editor now.

Step 4: Inside the generic browser, right-click on the TurrentContent package and SAVE! This is really important, otherwise you'll have to make these changes all over again when you reload the editor!

Done:
 Now, in UScript, when you apply rotations to the pivotController bone it should rotate the way you intend. In the editor, you can even place the turret upside-down or mount it on angled walls now and it should still track just fine (so long as you also remembered to apply the actor rotation like the tutorial tells you).







And It will Work Successful

No comments:

Post a Comment