- Home /
Question by
FlammingFart · Mar 06, 2013 at 12:20 PM ·
objectweaponparenting
parenting multiple objects (weapons)
how to parent multiple objects? i have the code for just 2 weapons only, but then how about 2 or more objects?
Comment
Best Answer
Answer by Shgoedt · Mar 06, 2013 at 01:33 PM
try something like this; mind you, this is all psuedo-code.
javascript:
var NumberOfWeapons : int = 2; // Just fill in how many you have
var AllWeaponsMounted : boolean = false;
if(!AllWeaponsMounted)
{
if(int i = 0; i < NumberOfWeapons; ++i)
{
weaponObject.transform.parent = characterObject.transform;
if(i == NumberOfWeapons)
{
AllWeaponsMounted = true;
}
}
}
C#
int NumberOfWeapons = 2; // Just fill in how many you have
bool AllWeaponsMounted = false;
if(!AllWeaponsMounted)
{
if(int i = 0; i < NumberOfWeapons; ++i)
{
weaponObject.transform.parent = characterObject.transform;
if(i == NumberOfWeapons)
{
AllWeaponsMounted = true;
}
}
}