Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 68 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Tutorials

»
CoD4 Mapping
ratings:
Awful Rating
Poor Rating
Average Rating
Good Rating
Excellent Rating
Rotating models and brushes
Versions: You must be logged in to view history.
FiremanPaul will show you how to rotate models or brushes around any axis and at any speed

This tutorial will show you how to rotate models or brushes around any axis and at any speed. One single script will allow multiple objects to be rotated and each can be on its own axis and rotating at its own speed. The following pictures show some of what is possible with rotating objects. Movement in a map can provide animation and “life” to a map.

The lights on this lighthouse are models and rotate very slowly, looks awesome in game.


The blades on this windmill are brushes and slowly rotate.


This fan rotates at a nice brisk pace.


Radiant Work

Rotating brushes:
1. Make the brushes into the object you want to rotate.

2. On the axis that you want to rotate around, make a small brush of 8x8 or 16x16 and texture it with the origin texture from the tools textures.

3. Select all the brushes that are to be rotated and select the origin brush.

4. With the brushes and origin selected, right click on the 2D screen and select script>brushmodel.

5. With the brushes and origin still selected, press N to bring up the Entity window and enter the following key/value entries.

Targetname/rotate
Script_noteworthy/x,y or z for the desired axis
Speed/ the number of seconds for object to make one revolution




In the above example, the brush model will rotate around the x axis, making a complete revolution once every 10 seconds. Press Esc and that finishes the work in radiant for a brushmodel.

Rotating models:
1. Place the model you wish to rotate. Models do not need an origin brush, and will rotate around their own origin.

2. With the model selected, right click the 2D screen and select script>model.

3. With the model still selected, press N and set the speed desired and script_noteworthy for the rotation axis. Press Esc and that finishes the radiant work for a model.

NOTE: prefabs can’t be rotated and this includes prefab models. If you want to rotate a vehicle for example, you would need to place the model and set it to rotate as shown above. Open the vehicle prefab and copy the clips to your map. Add an origin to the clips to match your model axis, and set it to rotate as a script_brushmodel as shown above. With the model and clips rotating in the same position on the same axis, at the same speed, they are still two separate entities, but in game will function as one.

The Script

main()
{
rotate_obj = getentarray("rotate","targetname");
if(isdefined(rotate_obj))
{
 for(i=0;i<rotate_obj.size;i++)
 {
  rotate_obj[i] thread ra_rotate();
 }
}
}

ra_rotate()
{
if (!isdefined(self.speed))
 self.speed = 10;
if (!isdefined(self.script_noteworthy))
 self.script_noteworthy = "z";

while(true)
{
 // rotateYaw(float rot, float time, <float acceleration_time>, <float deceleration_time>);
 if (self.script_noteworthy == "z")
  self rotateYaw(360,self.speed);
 else if (self.script_noteworthy == "x")
  self rotateRoll(360,self.speed);
 else if (self.script_noteworthy == "y")
  self rotatePitch(360,self.speed);
 wait ((self.speed)-0.1); // removes the slight hesitation that waittill("rotatedone"); gives.
 // self waittill("rotatedone");
}
}
 


 
The first part of the script collects all the entities with the target name of rotate. The second part checks the entity for speed, if none specified, it will be 10 as indicated in the script. This number can be changed. The last section checks the axis the entity is to rotate around. If no script noteworthy is specified, the Z axis will be assigned.

Files

The above script goes in its own gsc called mp_mymapname_rotate.gsc and goes in the rawmapsmp folder like the main gsc.

Add the line: mapsmpmp_mymapname_rotate::main(); to the main gsc

Add the line: rawfile,maps/mp/mp_mymapname_rotate.gsc to the missing asset csv (step 4 of compile tools)

This completes the script and files. Recompile the map from step 1 of the compile tools and enjoy!!!!



Making a test map to test rotating objects is easy if you use the existing test map that came with radiant.
Open the mp_test.map that came with radiant. Add brushes and/or models as described above. Create the gsc mp_test_rotate.gsc and add the lines to the main mp_test.gsc and to the missing asset csv. This test map is a great way to test this tutorial or any other prefab that will fit the map. Wanna see how something looks, test it in a ready to go map!![thumbs_up]

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»