Modeling Optimized Characters
Use one Skinned Mesh Renderer
Your character should use only a single Skinned Mesh Renderer. There is usually no reason to use multiple meshes for a character. Unity also has optimizations related to visibility culling and bounding volume updating which only kick in if you use one animation component and one skinned mesh renderer in conjunction. If you care about performance, multiple skinned meshes per character is not an option. If you use two skinned mesh renderers for one character instead of one, the time spent on rendering the character will most likely double!
Don't use many Materials
You also want to keep the number of Materials on that Mesh as low as possible. There is only one reason why you might want to have more than one material on the character: when you need to use a different shader (e.g. if you want to use a special shader for the eyes). However 2-3 Materials per character should be sufficient in almost all cases. If your character is carrying a gun, it might be useful to have the gun a separate object, simply because it might get detached.
Reduce amount of bones
Medium games use bone hierarchies with 15-60 bones. The fewer bones you use the faster it will run and with 30 bones you can do fairly good quality. Unless you really have to, we strongly recommend you use around 30 bones per character.
Polygon count
How many polygons you should use depends on the quality you are going after. Anything between 500-6000 triangles is reasonable. If you want lots of characters on screen, you will have to sacrifice in polycount per character, if you want it to run on old machines, you will have to use less polygons per character. As an example: Half Life 2 characters used 2500-5000 triangles per character. Next-gen AAA games running on PS3 or Xbox 360 usually have characters with 5000-7000 triangles.
Separate out IK and FK
Separate out Inverse Kinematics (IK) and Forward Kinematics (FK). When animations are imported the IK nodes are baked into FK, thus Unity doesn't need the IK nodes at all. You can either kill the GameObjects in Unity or the nodes in the modelling tool. By removing them, the IK nodes don't need to be animated every frame anymore. For this reason it is a very bad idea to intermix IK and FK hierarchies. Instead you should create two hierarchies: one strictly for IK and one for FK. This way you can very easily select the whole IK hierarchy and delete it.
Use reusable rigs
Create a rig which you can reuse. This allows you to share animations between different characters.
Name bones correctly
Name bones correctly (left hip, left ankle, left foot etc.). Especially with characters, naming your bones correctly is very important. For example if you want to turn a character into a Ragdoll you will have to find the right bones for each body part. If they are not named correctly, finding all the body parts will take much longer.
Source
Thursday, July 15, 2010
Wednesday, May 19, 2010
Monday, May 17, 2010
Randomizing the falling rocks
function mrr()
{
echo("Start of MoveRock Function");
$rockPile[0] = Bold1;
$rockPile[1] = Bold2;
$rockPile[2] = Bold3;
echo($rockPile[0]);
$dropPoints[0] = fall1;
$dropPoints[1] = fall2;
$dropPoints[2] = fall3;
%countRocks = 2;
%countDrops = 2;
%randRock = mFloor(getRandom((%countRocks)));
%randDrop = mFloor(getRandom((%countDrops)));
echo(%randRock);
echo(%randDrop);
echo($dropPoints[%randDrop]);
echo($rockPile[%randRock]);
%temp = $dropPoints[%randDrop].getTransform();
%lx = getword(%temp,0);
%ly = getword(%temp,1);
%lz = getword(%temp,2);
$rockPile[%randRock].setTransform(%lx SPC %ly SPC %lz SPC "0 0 1 0");
echo("End of MoveRock Function");
}
-Lonny
{
echo("Start of MoveRock Function");
$rockPile[0] = Bold1;
$rockPile[1] = Bold2;
$rockPile[2] = Bold3;
echo($rockPile[0]);
$dropPoints[0] = fall1;
$dropPoints[1] = fall2;
$dropPoints[2] = fall3;
%countRocks = 2;
%countDrops = 2;
%randRock = mFloor(getRandom((%countRocks)));
%randDrop = mFloor(getRandom((%countDrops)));
echo(%randRock);
echo(%randDrop);
echo($dropPoints[%randDrop]);
echo($rockPile[%randRock]);
%temp = $dropPoints[%randDrop].getTransform();
%lx = getword(%temp,0);
%ly = getword(%temp,1);
%lz = getword(%temp,2);
$rockPile[%randRock].setTransform(%lx SPC %ly SPC %lz SPC "0 0 1 0");
echo("End of MoveRock Function");
}
-Lonny
Wednesday, May 12, 2010
Droppin rocks on yo face!

So I finally figured out out to drop rocks(objects) out of the sky.
Set-up:
-Make a trigger
-Make a mark or spawn point where ever(name matters)
*note: The names and id's of objects and markers don't change when you restart the game, as far as I can tell. But the do on the player.
Link:
-In the "enterCommand" for the trigger call a function that you have made in an outside script. Mine: "MoveRock(Bold1,fall1);" Bold1 is my boulder, fall1 is my marker.
*note: You cant just set the position of the rock to the position of the mark like portal-ing a player. You must break it down using the getTransform() and getword() commands. Then use the setTransform()command to move your object.
This is my function code:
function MoveRock(%shape,%mark)
{
echo("Start of MoveRock Function");
//First break down the location of the mark
%temp = %mark.getTransform();
%lx = getword(%temp,0);
%ly = getword(%temp,1);
%lz = getword(%temp,2);
//Then set the location of the shape with those values
%shape.setTransform(%lx SPC %ly SPC %lz SPC "0 0 1 0");
echo("End of MoveRock Function");
}
-Lonny
Tuesday, May 11, 2010
Check this out!!!!
Ok, this might be confusing... ok, its really confusing, but its somewhat what I have been looking for!!! Its a break down of the hirearchy of how torque works and handles objects, events, etc for your games!! Here is the link: LINK
So I recommend you click through this graph. If its a red box around the term, it means it continues, if its black its a dead end.
Now that I look at this site more it has alot of what I have been looking for as far as breaking down how the torque code works! Here is the home page if you havnt figured it out already: Torque Engine Reference
Hope this helps
-Lonny
So I recommend you click through this graph. If its a red box around the term, it means it continues, if its black its a dead end.
Now that I look at this site more it has alot of what I have been looking for as far as breaking down how the torque code works! Here is the home page if you havnt figured it out already: Torque Engine Reference
Hope this helps
-Lonny
How to make a new object via Torque Script
******I have not tested this yet!!!**********
In Torque, every item in the game world is an object, and all game world objects can be accessed via script. For example, Player, WheeledVehicle, Item, etc are all accessible via script, though they are defined in C++.
Objects are created in TorqueScript using the following syntax:
%var = new ObjectType(Name : CopySource, arg0, ..., argn)
{
[existing_field0 = InitialValue0;]
...
[existing_fieldM = InitialValueM;]
[dynamic_field0 = InitialValue0;]
...
[dynamic_fieldN = InitialValueN;]
};
This syntax is simpler than it looks. Let's break it down:
%var
Is the variable where the object's handle will be stored.
new
Is a key word telling the engine to create an instance of the following ObjectType.
ObjectType
Is any class declared in the engine or in script that has been derived from SimObject or a subclass of SimObject. SimObject-derived objects are what we were calling "game world objects" above.
Name (optional)
Is any expression evaluating to a string, which will be used as the object's name.
CopySource (optional)
The name of an object which is previously defined somewhere in script. Existing field values will be copied from CopySource to the new object being created. Any dynamic fields defined in CopySource will also be defined in the new object, and their values will be copied. Note: If CopySource is of a different ObjectType than the object being created, only CopySource's dynamic fields will be copied.
arg0, ..., argn (optional)
Is a comma separated list of arguments to the class constructor (if it takes any).
datablock
Many objects (those derived from GameBase, or children of GameBase) require datablocks to initialize specific attributes of the new object. Datablocks are discussed below.
existing_fieldM
In addition to initializing values with a datablock, you may also initialize existing class members (fields) here. Note: Note: In order to modify a member of a C++-defined class, the member must be exposed to the Console.
dynamic_fieldN- Lastly, you may create new fields (which will exist only in Script) for your new object. These will show up as dynamic fields in the World Editor Inspector.
Example: One object that doesn't use a datablock and one that does:
// create a SimObject w/o modifying any fields
$example_object = new SimObject();
// create a SimObject w/ dynamic fields
$example_object = new SimObject()
{
a_new_field = "Hello world!";
};
// create a StaticShape using a datablock
datablock StaticShapeData(MyFirstDataBlock)
{
shapeFile = "~/data/shapes/player/player.dts";
junkvar = "helloworld";
};
new StaticShape()
{
dataBlock = "MyFirstDataBlock";
position = "0.0 0.0 0.0";
rotation = "1 0 0 0";
scale = "1 1 1";
};
I got this off of this site: TorqueWiki
-Lonny
In Torque, every item in the game world is an object, and all game world objects can be accessed via script. For example, Player, WheeledVehicle, Item, etc are all accessible via script, though they are defined in C++.
Objects are created in TorqueScript using the following syntax:
%var = new ObjectType(Name : CopySource, arg0, ..., argn)
{
[existing_field0 = InitialValue0;]
...
[existing_fieldM = InitialValueM;]
[dynamic_field0 = InitialValue0;]
...
[dynamic_fieldN = InitialValueN;]
};
This syntax is simpler than it looks. Let's break it down:
%var
Is the variable where the object's handle will be stored.
new
Is a key word telling the engine to create an instance of the following ObjectType.
ObjectType
Is any class declared in the engine or in script that has been derived from SimObject or a subclass of SimObject. SimObject-derived objects are what we were calling "game world objects" above.
Name (optional)
Is any expression evaluating to a string, which will be used as the object's name.
CopySource (optional)
The name of an object which is previously defined somewhere in script. Existing field values will be copied from CopySource to the new object being created. Any dynamic fields defined in CopySource will also be defined in the new object, and their values will be copied. Note: If CopySource is of a different ObjectType than the object being created, only CopySource's dynamic fields will be copied.
arg0, ..., argn (optional)
Is a comma separated list of arguments to the class constructor (if it takes any).
datablock
Many objects (those derived from GameBase, or children of GameBase) require datablocks to initialize specific attributes of the new object. Datablocks are discussed below.
existing_fieldM
In addition to initializing values with a datablock, you may also initialize existing class members (fields) here. Note: Note: In order to modify a member of a C++-defined class, the member must be exposed to the Console.
dynamic_fieldN- Lastly, you may create new fields (which will exist only in Script) for your new object. These will show up as dynamic fields in the World Editor Inspector.
Example: One object that doesn't use a datablock and one that does:
// create a SimObject w/o modifying any fields
$example_object = new SimObject();
// create a SimObject w/ dynamic fields
$example_object = new SimObject()
{
a_new_field = "Hello world!";
};
// create a StaticShape using a datablock
datablock StaticShapeData(MyFirstDataBlock)
{
shapeFile = "~/data/shapes/player/player.dts";
junkvar = "helloworld";
};
new StaticShape()
{
dataBlock = "MyFirstDataBlock";
position = "0.0 0.0 0.0";
rotation = "1 0 0 0";
scale = "1 1 1";
};
I got this off of this site: TorqueWiki
-Lonny
Monday, May 10, 2010
Portals
Portals:
Set-up:
-make a trigger(name doesn't matter)
-make a spawn point or marker somewhere else(remember name, for my example mine is named "jps")
Linking:
When an object enters a trigger, it is passed as "%obj" to the functions.
-click on your trigger
-click on the "entercommand" field to add your own script code.
-in the code put:
%obj.position = jps.position;
Notes: I assume this applys to all objects, so if you ran an NPC thru the portal they should be transported as well. It didn't transport my rocket when i shot it through the portal tho...
my notes for the day
Lonny
Set-up:
-make a trigger(name doesn't matter)
-make a spawn point or marker somewhere else(remember name, for my example mine is named "jps")
Linking:
When an object enters a trigger, it is passed as "%obj" to the functions.
-click on your trigger
-click on the "entercommand" field to add your own script code.
-in the code put:
%obj.position = jps.position;
Notes: I assume this applys to all objects, so if you ran an NPC thru the portal they should be transported as well. It didn't transport my rocket when i shot it through the portal tho...
my notes for the day
Lonny
Subscribe to:
Posts (Atom)