User Animated Section of Model - Tutorial
User animated section of model - tutorial
Primary target - Vehicles
This tutorial is to show the basics of how to animate a section of a vehicle model with a USER action.
Specific subject pictures are a aeroplane ramp, but any vehicle can have similar.
(1) - MODEL
- First thing that needs to be done is create the section to be animated (an access ramp in this case).
- This section needs its own name in O2. "RAMP1" in this example.
- This section needs to be created and named in every RESOLUTION LOD as well as the GEOMETRY LOD.
- If someone is going to walk on this section, then it should also be created and named in the ROADWAY as well.
- In the MEMORY LOD you need to create 2 points/vertexes that mimic the "hinge" point. The points form the line around which the ramp will rotate.
- These 2 points need also to be named. "AXIS_RAMP1" in this case.
- For the USER/Player to access the Action menu of the vehicle, we definite points or locations where the required action will appear in the player menu.
- These User Action point(s) we name for our example "ACTION_RAMP1"
(2) - MODEL.CFG
In the CFG Skeleton section of the model.cfg file you should add something like this;
class myPlaneBones: Plane
skeletonInherit = "";
Its important to have the ,"" bit, as this defines "ramp1" as being hinged off the ROOT or main part of the model.
In the CFG Model section of the model.cfg you should add something like this;
class NameofmyP3Dfile: Plane
skeletonName = "myPlaneBones";
sourceAddress = "clamp";
TIP: If you have saved the MODEL.CFG in your addon project file, when you reopen your model in O2, in Buldozer you can use the middle mouse button and wheel to select/change/view the demo animation in action.
- If the animation / ramp animations in the wrong direction, just change "rad 22" (which is 22 degrees) to "rad -22"
- "UserRamp1" (the animation "Source") is defined (will be defined) in the CONFIG.CPP file.
(3) - CONFIG.CPP
Inside you CFGVehicle definition you need to have something like;
class AnimationSources: AnimationSources
source = "user";
animPeriod = 20;
- The "UserRamp1" here must be the same name as used in the MODEL.CFG as "source".
- source: The controller is defined as a user animation. Always "user" in these cases.
- animPeriod: The animation period used for this controller. In seconds.
- initPhase: Initial phase / status when object is created. 0 = CLOSED or O2 default modeled state.
To create the pop-up menu near the vehicle that allows players to open or close the ramp, add code like this inside the CFGVehicle definition;
condition="(this animationPhase ""AnimateRAMP1"" == 0)";
statement="this animate [""AnimateRAMP1"",1];";
condition="(this animationPhase ""AnimateRAMP1"" == 1)";
statement="this animate [""AnimateRAMP1"",0];";
- ACTION_RAMP1 is the point(s) we named in the MEMORY LOD
- AnimateRAMP1 is the same name we used in the CFGModel section of the model.cfg
- "Open Ramp" and "Close Ramp" are exactly the menu actions the player will see.
- RADIUS is the radius in meters around the ACTION_RAMP1 points that players will see the action in menu