Re: Playing synchronized animations

This is not the code i used in the past. I did this to show what's my way.
Of course it's possible to be errors in this code, because i finished it in minutes and did not tried in game. As already i said, it's just for showing my way.

Code: Select all

... IGameFramework* const pGameFramework = gEnv->pGameFramework;
IGameObject* const pGameObject = pGameFramework->GetGameObject(LocalPlayer's id);

IAnimatedCharacter* const pAnimChar = pGameObject ? (IAnimatedCharacter*) pGameObject->QueryExtension("AnimatedCharacter") : NULL;
if (pAnimChar && pAnimChar->GetActionController())
const EntityId slaveChar = Enemy's id;// example id
IGameObject* pSlaveGameObject = pGameFramework->GetGameObject(slaveChar);
IAnimatedCharacter* pSlaveAnimChar = pSlaveGameObject ? (IAnimatedCharacter*) pSlaveGameObject->QueryExtension("AnimatedCharacter") : NULL;

if (pSlaveAnimChar && pSlaveAnimChar->GetActionController())
IAnimationDatabaseManager& dbManager = gEnv->pGameFramework->GetMannequinInterface().GetAnimationDatabaseManager();
uint32 db_crc32 = CCrc32::ComputeLowercase("");// db place is empty
const IAnimationDatabase* db = dbManager.FindDatabase(db_crc32);

const string& scopeContextName = "";
const string& requestedScopeContext = scopeContextName.empty() ? "SlaveChar" : scopeContextName;
const TagID scopeContext = pAnimChar->GetActionController()->GetContext().controllerDef.m_scopeContexts.Find(scopeContextName.c_str());

bool toggleLogic;
pAnimChar->GetActionController()->SetSlaveController(*pSlaveAnimChar->GetActionController(), scopeContext, toggleLogic, db);

IAnimatedCharacter* const pAnimChar = pGameObject ? (IAnimatedCharacter*) pGameObject->QueryExtension("AnimatedCharacter") : NULL;
const int priority = 20;
m_CurrentAction = new TAction<SAnimationContext>(priority, fragID, tagState);

Who is online

Users browsing this forum: No registered users and 4 guests