|
|
|
|
|
Please take note! For mod developers working with Unreal Tournament 2003, this documentation is meant to be a starting point for your own explorations into UT2003, not a definitive guide. There will be differences between the documentation here and the product in your hands, and you may have to figure out quite a bit for yourself. Check out the Unreal Tournament 2003 page in the Unreal Powered area for links to community sites if you're having problems. UDN is a licensee support site, and cannot provide technical support or game-specific assistance to end users.
|
|
|
|
KarmaExample2 |
|
|
|
|
|
Licensees can log in.
Interested in the Unreal engine? Check out the licensing page.
Questions about UDN itself? Contact the UDN Staff.
|
|
|
|
|
|
|
|
|
Last updated by James Golding ( jamesg@epicgames.com ) 11th October 2002.
Note - this tutorial is for an earlier build of the Unreal Engine, NOT for UT2003. I will update the documentation as soon as I get a chance!
See Also:
Karmareference.html
KarmaExample1
ImportingPhysicsAssets
If you need any help or have any questions e-mail me in Oxford England (ian.tierney@mathengine.com) or (James.Golding@mathengine.com).
- KarmaExample2
- Overview
- Getting Started
- Adding To a Level
- Adding a Hinge Constraint
- Motorising The Hinge
In this example we'll again create and import a karma actor (see KarmaExample1).
- We'll show you how to add a hinge joint.
- We'll show you how to motorise a hinge joint
From Unreal Editor create a simple room, with a start position.
Create a suitable Kactor, this will be hinged to the world so that it may only rotate about 1-axis. So we want somthing that rotates in this manner.
(See KarmaExample1 for creating/importing physic models)
Import the .ASE file, by opening the static mesh browser >File>Import.
You should get a message: "Karma Collision Data Found. Do you want to add to Static Mesh?"
Answer YES, and Unreal Editor will convert the collision geometry parts into the simple shapes they represent.
Karma Physics will automatically calculate a default contre-of-mass position and inertia tensor (represents how the mass is distributed) for this static mesh.
Note you must resave the .USX package in order to use this Static Mesh.
Select the required Kactor physics mesh in the static mesh browser. (It will have a * to indicate it has physics properties such as mass etc.)
Now right click on one off your viewing areas and select "Add Karma Actor Here"
Rebuild the level and play it. The Kactor should appear in your level, and react in a physically releastic way.
Note that by default Kactors are disabled untill they collide with something. This saves computation time, so you should set up your physics bodies in stable looking positions and leave the default to disabled. You can set change the default: Kactor properties > Kparams > KarmaParams > KStartEnabled, but this isn't advised unless you want something to fall on a players head as soon as s/he starts.
Constraints restrict the motion of physics bodies. There are two main types:
1.Contact Constraints: When bodies come into contact, one or more contact constraints are automatically created to prevent the bodies from penetrating.
2.Joint Constraints: We can also add in joint constraints in the Unreal Editor. These restrict the motion of Kactors directly. For example, ball and socket and hinge are two joint types.
The hinge joint restricts bodies so that they may only rotate about a single axis. For example doors are hinged to walls so that the door may only rotate about one axis. We're going to attach a fan to the world using a hinge joint and then we're going to shoot it up real good.
From the Actor Browser, browse down the hierarchy to select the KHinge constraint. Actor>KActor>KConstraint>Khinge.
Once the Khinge is selected you can add one into the world by right clicking on a viewport and selecting "Add Khinge here"
You should see a small billboard icon representing the hinge.
But Wait! This hinge will do nothing yet, as there is nothing attached for it to constraint.
We can hinge up to two KActors together, but we only want to fix our fan to the world.
Double Click the KHinge icon to view the KHinge properties.
Under the Karmaconstraint properties you see KConstraintActor1 and KConstraintActor2. These are the two bodies that can be constained by the KHinge.
Type in the fan objects name in the Karma Constraint Actor1 (an objects name can be found by double clicking it to bring up its properties and selecting Object > Name).
Although the Khinge can join two Actors, if you only fill in one, that object will be hinged to the world at the position of the Hinge.
Rebuild your level. If you shoot the fan, it should only rotate about a single axis.
The hinge axis is represented by a red line that appears when you select the hinge icon. You can rotate and move this axis in Unreal Editor.
We can motorise the hinge joint to drive the fan around.
Double click the Khinge icon and Open its Karma Constraint Properties.
To motorise the hinge we need to change the following 3 properties:
1. KHingeType : This should be set to HT_Motor.
2. KDesiredAngVel : This is the angular velocity the motor is trying to reach. (Don't confuse this with KDesired angle, which is used when you want control bodies rotation to a predifined angle. We want our fan to spin indefinitly, so just leave this a 0)
3. KMaxTorque : Nothing is going to spin without torque, this is the max torque applied to reach the desired angular velocity.
That's it. Rebuild your level and your fan should be spining around as if by magic. If its not shoot it, this should enable the fan, which means that it will be physically simulated.
Attachment: | Action: | Size: | Date: | Who: | Comment: |
Fan_ASE.zip | action | 100996 | 14 Mar 2002 - 16:44 | KarmaUnrealIntegrationTeam | |
Fan.max | action | 192512 | 14 Mar 2002 - 16:45 | KarmaUnrealIntegrationTeam | |
|
|