1. Trang chủ
  2. » Công Nghệ Thông Tin

Creating 3D Game Art for the iPhone with Unity Part 7 pps

28 354 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 28
Dung lượng 2,55 MB

Nội dung

FIG 6.45 In This Image, the Highlighted Areas Are the Keyframes that Were Created by Duplicating the Previous Keyframe. Make Sure Frame Range Is Set Correctly Number one and the most obvious is that you’ll need to make sure that you set the End Range for the animation. If your animation is 27 frames long, then be sure that the End Range is 27. For cyclic animations, you can set the clips to loop in the FBX Import Settings as shown in Fig. 6.46. If you leave extra frames in the loop, the animation will appear to pause before the loop cycles effectively breaking the loop. FIG 6.46 You Can Set the Loop Mode for Animations in the FBX Import Settings. Baking Keys When exporting animation data from a 3D program such as Blender into Unity iOS, you may need to bake the keyframes so that the animation is 150 Creating 3D Game Art for the iPhone with Unity FIG 6.47 By Sampling the Keyframes, You Will Bake the Curve, Which Puts a Keyframed Value on Each Frame. interpolated correctly. If you find that your animation data doesn’t seem to be translating correctly in Unity iOS and this will typically happen when using IK, you can choose to bake the animation values to a key on each frame. Essentially, this is taking the interpolation out of the animation curve by plac- ing an exact keyed value at each frame in the animation. If you’re using native formats from 3D applications such as .ma, .c4d, and .max, you can actually bake animations in Unity iOS by checking the Bake Animations options in the Importer Settings. An animation bake step happens during export from your 3D tool to the FBX format. When importing objects into Unity iOS using a 3D tool’s native format, Unity iOS is actually opening the application behind the scenes and exporting an FBX file. However, the FBX exporter in Blender doesn’t have an option for baking animation, so you can bake the F-Curves in Blender before exporting the FBX file. The quickest way is from the DopeSheet Editor. First, hit the A key to select all of the keyframes and then choose Sample Keyframes from the Key menu or press Shift + O. Sampling the keyframes will bake the curves and place a key on each frame as shown in Fig. 6.47. 151 Animation Using Blender Disable Optimize Keyframes and Selected Objects One final thing I want to mention in regards to exporting an FBX file from Blender is to be sure to deselect both the Selected Objects and Optimize Keyframes options in the FBX export dialog as shown in Fig. 6.48. The Selected Objects will only export the selected objects in your scene, and I find that more times than not, this is a hassle as you think everything is selected when exporting only to find that something is missing like your mesh when you import the file into Unity iOS. You can quickly deselect the unnecessary scene items such as Cameras and Lamps in the FBX export dialog. If you look back at Fig. 6.49, you can see that I’ve deselected Cameras, Lamps, and Empties from the export, as I don’t need these items in Unity iOS. The Optimize Keyframe setting is a big one. This option is supposed to remove double keyframes and should be harmless; but from my experience, this option almost always removes important keyframes and causes major issues when the FBX animation is played in Unity iOS or opened in any other 3D package for that matter. For example, in Fig. 6.49, you can see that with Optimize Keyframes enabled, the animation from Blender comes in with major distortions as important keyframes have been removed. Summary In this chapter, we completed the rigging and animation process for the Tater game asset. We discussed several key aspects for rigging such configuring bone rotation and using the IK Constraint. We also FIG 6.48 You Need to Be Careful of the Selected Objects and Optimize Keyframes Settings When Exporting an FBX from Blender. FIG 6.49 This Image Shows the Effect of Having Optimize Keyframes Enabled on the FBX Export When the File Is Imported into Unity iOS. 152 Creating 3D Game Art for the iPhone with Unity discussed creating cyclic animations and creating Blender Actions to help in exporting multiple FBX files. In Chapter 7, we are going to take a final look at animating game assets for the iPhone and iPad by discussing the animation of props. We’ll take a look at using Blender’s Bullet Physics Engine to create a Rigid Body simulation to animate exploding targets the player will shoot in the book’s demo app. We’ll also take a look at the animation for Tater’s weapon, Thumper. 153 Animation Using Blender [...]... Fig 7. 26, we can set up the Rigid Body simulation Fig 7. 23╇ The Separate, By Loose Parts, Command Will Break Up the Mesh into Separate Meshes 172 Animation Using Blender Fig 7. 24╇ Right-click to Position the 3D Cursor Where You’d Like to Place the Pivot 173 Creating 3D Game Art for the iPhone with Unity Fig 7. 25╇ Use the Origin to 3D Cursor Command to Snap the Pivot to the 3D Cursor Fig 7. 26╇... in€Fig 7. 28 Animation Using Blender Fig 7. 27 •‡ A Plane Was Added to Stand in for the Ground Fig 7. 28╇ The Blast Zone Is a Simple UV Sphere Object 175 Creating 3D Game Art for the iPhone with Unity Now that all of the objects are in place, we’ll start configuring the appropriate meshes to be a Rigid Body First, set the engine for rendering to Blender Game as shown in Fig 7. 29 We’ll configure the sphere... shown in Fig 7. 22 So, I found it to be a hit or miss type of operation, which called for me to either separate the mesh in Blender or rely on another format Fig 7. 22╇ The OBJ Format Does Support Multiple Meshes but It Depends on the OBJ Importer Such as with Maya, There Is an Option to Import Multiple Meshes 171 Creating 3D Game Art for the iPhone with Unity Instead of using another format, such... in Unity iOS as was produced in Blender using the Â� NLA€Editor As you can see, this is a very powerful workflow as the shoot animation can now be added to any other animations such as a walk cycle I no Fig 7. 17 •‡ The blendMode for the Shoot Variable Is Set to Be Additive 1 67 Creating 3D Game Art for the iPhone with Unity Fig 7. 18╇ Here You Can See the Script That Plays the Shoot Animation When the. .. Creating 3D Game Art for the iPhone with Unity Fig 7. 13╇ The Blending Mode for the Clip Is Set to Add in the Properties Panel for the Track Fig 7. 14╇ You Can Adjust the Speed of a Clip in the Playback Settings by Changing the Scale Property 164 Now, the shoot animation is being additively blended over top of the run animation This is also what is happening in Unity s Animation System when you work with. .. game for potential bottlenecks With newer hardware, the CPU on the iDevices are becoming more capable than the GPU, which means if your game is already heavy on rendering, this method might not be the best solution To compliment this section, in Chapter 9, we’ll discuss creating the same explosion effect in Unity iOS using a physics simulation, 169 Creating 3D Game Art for the iPhone with Unity FIG 7. 20╇... With the sphere selected, go to the Physics tab on the Properties panel and set the Physics Type to Rigid Body as shown in Fig 7. 30 Fig 7. 29╇ The Rendering Engine Is Set to Blender Game at the Top of the UI Fig 7. 30╇ This Image Shows the Physics Type Set to Rigid Body on the Physics Tab Fig 7. 31╇ The Radius Is Visualized in the Viewport as a Dashed Circle 176 In the Physics tab, you can set the. .. See a Script That Offsets the Rotation of the Weapon Using rotation.eulerAngles() With this setup, you can replace the weapon when needed As long as the pivots in different weapons match positions and they’re relatively the same size in regards to how the character is going to hold the weapon, this workflow works well 161 Creating 3D Game Art for the iPhone with Unity Using the NLA Editor Now that we’ve.. .Creating 3D Game Art for the iPhone with Unity Unity iOS, all the bones are regarded as Transforms This allows you manipulate each bone just as you would any other object in Unity iOS In Blender, I’ll still need the weapon attached to the character in order to animate the action correctly What I did was to parent the weapon to Tater’s IK_ Hand.L Bone using a ChildOf constraint as shown in€Fig 7. 6... Export 165 Creating 3D Game Art for the iPhone with Unity Muting a track will allow us to only export the run Action, which will give us the base run animation needed for our character Next, we’ll then re-enable the shoot track and disable the run, and then export this shoot animation to a Â� separate FBX file using the “@” notation Since the shooting animation only covers shooting, we can then effectively . from a 3D program such as Blender into Unity iOS, you may need to bake the keyframes so that the animation is 150 Creating 3D Game Art for the iPhone with Unity FIG 6. 47 By Sampling the Keyframes,. Image Shows the Effect of Having Optimize Keyframes Enabled on the FBX Export When the File Is Imported into Unity iOS. 152 Creating 3D Game Art for the iPhone with Unity discussed creating cyclic. that you set the End Range for the animation. If your animation is 27 frames long, then be sure that the End Range is 27. For cyclic animations, you can set the clips to loop in the FBX Import

Ngày đăng: 08/08/2014, 13:21

TỪ KHÓA LIÊN QUAN