MCPcopy Create free account
hub / github.com/carbonengine/trinity / GetLocatorInObjectSpace

Method GetLocatorInObjectSpace

trinity/Eve/SpaceObject/EveSpaceObject2.cpp:3260–3284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3258}
3259
3260void EveSpaceObject2::GetLocatorInObjectSpace( Vector3& position, Vector3& direction, const Locator& locator ) const
3261{
3262 Vector3 damagelocatorDirection = (Vector3)XMVector3Rotate( Vector3( 0.f, 1.f, 0.f ), locator.direction );
3263 // We're assuming for now that the bone 0 isn't animated for performance reasons.
3264 if( locator.boneIndex <= 0 )
3265 {
3266 // damage locator is not attached to a bone, return the position
3267 position = locator.position;
3268 direction = damagelocatorDirection;
3269 return;
3270 }
3271
3272 // If the damage locator is animated we extract the bone matrix and apply it to the damage locator position
3273 if( m_animationUpdater && m_animationUpdater->IsInitialized() )
3274 {
3275 if( locator.boneIndex < m_animationUpdater->GetMeshBoneCount() )
3276 {
3277 const Float4x3* bones = m_animationUpdater->GetMeshBoneMatrixList();
3278 Matrix boneTF = IdentityMatrix();
3279 TriMatrixCopyFrom3x4( &boneTF, &bones[locator.boneIndex] );
3280 position = XMVector3TransformCoord( locator.position, boneTF );
3281 direction = XMVector3TransformNormal( damagelocatorDirection, boneTF );
3282 }
3283 }
3284}
3285
3286Be::Result<std::string> EveSpaceObject2::GetLocalBoundingBoxFromScript( std::pair<Vector3, Vector3>& result )
3287{

Callers

nothing calls this directly

Calls 5

TriMatrixCopyFrom3x4Function · 0.85
Vector3Class · 0.50
IsInitializedMethod · 0.45
GetMeshBoneCountMethod · 0.45
GetMeshBoneMatrixListMethod · 0.45

Tested by

no test coverage detected