Unreal Karma Actors CIS 488588 Bruce R Maxim
Unreal Karma Actors CIS 488/588 Bruce R. Maxim UM-Dearborn 9/30/2020 1
Karma • Unreal Physics Engine • Used to make objects in your scene react to physical forces (gravity, explosions, collisions) • Many aspects of the Karma engine can only be exploited using Unreal Script • To build rag doll characters requires the use of Maya or other external 3 D packages and the Karma Authoring tool known as KAT • There are some things that can be done with Karma objects inside Unreal. Ed 9/30/2020 2
Karma Theory - 1 • The Karma engine make use of a special type actor known as a KActor • KActors have the Physics property (found under the Movement category) set to PHYS_Karma • This setting passes control of an object’s movement to the Karma physics engine • How the object reacts is determined by the setting KParams property under the Karam category in the object’s Properties window 9/30/2020 3
Karma Theory - 2 • If you keep drilling down you will find lots of properties that are editable (mass, buoyancy, friction) • The b. Block. Karma property (under the Collision category) determines whether a KActor will react to placeable item found in the current map • Setting b. Block. Karma to True makes collisions with Karma objects and Actor surfaces possible and reactable 9/30/2020 4
Creating Simple Karma Actor Tutorial 11. 1 • Use the map file Tutorial 11_01_Start. ut 2 • Open the Static. Mesh browser and locate the package AWHardware, find the Decorations category, and select sh_barrel_M_JM • Use the RMB and add the barrel to the level using the “add Karma Actor” item from the context menu • You will need to adjust the position of the barrel • Rebuild the level, save, and test the level 9/30/2020 5
Creating Simple Karma Actor Tutorial 11. 2 • To see anything happen with the barrel you will need to shoot it with something big, like the Rocket. Launcher (this is even true if the barrel started the level hovering in the air) • To make the barrel come alive when you first enter the level, open the Properties window, and drill down Karam>Kprams>Karma. Params my. Level>Karam. Prarams • Set the property KStart. Enabled to True • Rebuild, save, and test the level 9/30/2020 6
KBS Joints - 1 Tutorial 11. 2 • Use the map file Tutorial 11_02_Start. ut 2 • Use the Static. Mesh browser to open the package Chapter 11. utx, in the Light. System group select Short. Chain • Use the RMB button to open the context menu, select Add Karma Actor, and add the chain to the middle of the ceiling • Use Crtl-W to duplicate the chain and put a copy of the chain beneath the first chiain 9/30/2020 7
KBS Joints - 2 Tutorial 11. 2 • Open the Static Mesh browser and select Light inside the Chapte 11 package Light. System group • Use the RMB and add the Light as a Karma Actor from the context menu to the end of the chain • If we run the level now, shooting the light just causes it to fall to the floor • Open the Actor class browser, expand Kactor>Kconstraint and select KBSJoint 9/30/2020 8
KBS Joints - 3 Tutorial 11. 2 • Use the RMB to add a KBSJoint near the lamp • Position the KBSJoint so that it connects the chain to the ceiling • Use Ctrl-W duplicate the KBSJoint and place it between the chain pieces • Use Ctrl-W duplicate the KBSJoint and place it between the chain and the light • Open the Properties window for the KBSJoint on the ceiling and expand the Karma. Constraint category 9/30/2020 9
KBS Joints - 4 Tutorial 11. 2 • Set the value of KConstraint. Actor 1 to the name of the top chain piece • Open the Properties window for the KBSJoint between the two chain pieces • Set the value of KConstraint. Actor 1 to the name of the top chain piece and set the value of KConstraint. Actor 2 to the name of the bottom chain piece • Open the Properties window for the KBSJoint between the chain and the light 9/30/2020 10
KBS Joints - 5 Tutorial 11. 2 • Set the value of KConstraint. Actor 1 to the name of the bottom chain piece and set the value of KConstraint. Actor 2 to the name of the light • It is possible that you may need to go into the Properties window for each of the Karma actors and set the value of b. High. Detail. Only to False in the Kara. Params dialog (otherwise they may not react to speed up game play) 9/30/2020 11
KCone. Limit Tutorial 11. 3 • Use the map file Tutorial 11_03_Start. ut 2 • Open the Actor class browser, expand KActor>Kconstraint, and select KCone. Limit • Use the RB and choose Add KCone. Limit from the context menu to add the actor near the Light • Rotate the KCone. Limit so the red arrow points down the z-axis • You can adjust values of KConstraint. Actor 1 and 2 to point the two chain pieces and adjust the value of KHalf. Angle to get the right effect 9/30/2020 12
Dynamic Bridge - 1 Tutorial 11. 4 • Use the map file Tutorial 11_04_Start. ut 2 • If we run the level and shoot the bridge it will simply collapse • We can add KHinge actors to make it bouncy instead • Open the Actor class browser, exapnd Kactor>Kconstraint, and select Khinge • Use the RMB to add the Khinge to connect the first bridge piece and the wall 9/30/2020 13
Dynamic Bridge - 2 Tutorial 11. 4 • Rotate the KHinge so that the arrow points towards the wall • Use Ctrl-W to duplicate the KHinge and place the copy to connect the first and second bridge pieces • Continue the process until you reach the far end of the bridge • Open the Properties window for the first Khinge and expand the Karma. Constraint category 9/30/2020 14
Dynamic Bridge - 3 Tutorial 11. 4 • Select the Karma. Constraint. Actor 1 property, click the Find button and then click the first bridge piece • For the KHinges connecting to bridge pieces you will need to do this for bridge pieces on both sides of KHinge to set Karma. Constraint. Actor 1 and Karma. Constraint. Actor 2 • You may need to set b. High. Detail. Only to False • Rebuild, save, and test 9/30/2020 15
Working Fan - 1 Tutorial 11. 5 • Use the map file Tutorial 11_05_Start. ut 2 • To get the fan do more that fall off the wall when shot, you need to use a KHinge • Open the Actor class browser, expand KActor>Kconstraint, and select KHinge • Use the RMB to add the Khinge near the fan, move the KHinge to the center of the fan, and rotate it to ensure its axis matches the fan • Open the Properties window for the KHinge 9/30/2020 16
Working Fan - 2 Tutorial 11. 5 • Set the value of KConstraint. Actor 1 property to point to the fan • Change the KHinge. Type property to HT_Motor to give the fan constant motion • Change the value of KDesired. Ang. Vel to 16384 and the value of KMax. Torque to 100 • Rebuild the map, save, and test (when you shoot the fan with the Rocket. Launcher it will run continuously) 9/30/2020 17
Creating Catapult – 1 Tutorial 11. 6 • Use the map file Tutorial 11_06_Start. ut 2 • Open the Actor class browser, expand Kactor>Kconstraint, and select KHinge • Use the RMB and place a KHinge near the fromt of the catapult facing the bridge • Rotate the KHinge so that it points down the yaxis • Set the KConstraint. Acor 1 property to point to the catapult 9/30/2020 18
Creating Catapult – 2 Tutorial 11. 6 • Change the KHinge. Type to HT_Springy • Change KStiffness to 5000 • Change Kdampening to 250 (so the catapult will not swing back and forth too much) • To add a trigger, open the Actor class browser, exapnd Triggers, select Use. Trigger • Use the RMB to add a Use. Trigger near the catapult 9/30/2020 19
Creating Catapult – 3 Tutorial 11. 6 • Open the Properties window for Use. Trigger, expand he Advanced category, and set b. Hidden to False • Expand the Events category and set the Event property to Trigger. Catapult • Open the Properties window for the KHinge, expand the Object category, change value of Initial. State to Toggle. Desired • Expand the Karma. Constraint category and set KAlt. Desired. Angle to 16384 (90 degrees) 9/30/2020 20
Creating Catapult – 4 Tutorial 11. 6 • To associate the Use. Trigger with the KHinge, expand the Events category, and set the Tag property to Trigger. Catapult • To test the catapult place a copy of the Karma barrel on top of the catapult (remember to use add Karma Actor) • Open the barrel Properties window, set b. High. Detailed to False, b. KStart. Enabled to True, and set Kmass to 0. 5 • Rebuild the level, save, and test it 9/30/2020 21
Using Ragdolls - 1 Tutorial 11. 7 • Use the map file Tutotial 11_07_Start. ut 2 • You need an actor to serve as a template for your ragdoll, any KActor will do (so start with the barrel) – remember to use “add KActor” • Open the Properties window for the new KActor, expand the Display category, change the Draw. Type property to DT_Mesh • To set the Mesh property, open Animation browser, open the Human. Male. A package and select the Merc. Male. A mesh, and click Use button 9/30/2020 22
Using Ragdolls - 2 Tutorial 11. 7 • Move the new model so that the ragdoll right hand is placed inside the KBSJpoint at the bottom of the chain • Open the Properties window of the KBSJoint, expand the Karma. Constraint category, and set the KConstraint. Actor 2 to point to the Merc. Male. A mesh • The correct mesh is displayed, but behavior is not right 9/30/2020 23
Using Ragdolls - 3 Tutorial 11. 7 • Open the Property window for the ragdoll, expand the Movement category, and change the Physics property value to PHYS_Karma. Rag. Doll • Expand the Karma category, drill down to the KParams property, click the Clear button • Select the Karma. Params. Skel and click the New button 9/30/2020 24
Using Ragdolls - 4 Tutorial 11. 7 • Expand the KParams category and drill down so that you can set the Kskeleton property to Male • You may also need to set b. High. Detail. Only to False • Rebuild, save, test, and fiddle with parameters to get the right effects 9/30/2020 25
KAT • There is a Karma authoring tool that let’s you build your own KActors • This requires the use of a 3 D model exported from Maya or similar tool • Using KAT you can create your own rag dolls and other reactive devices 9/30/2020 26
- Slides: 26