FVector UPrimitiveComponent::GetPhysicsLinearVelocity(FName BoneName)
{
if (FBodyInstance* BI = GetBodyInstance(BoneName))
{
return BI->GetUnrealWorldVelocity();
}
else if (Chaos::FConstPhysicsObjectHandle Handle = GetPhysicsObjectByName(BoneName))
{
FLockedReadPhysicsObjectExternalInterface Interface = FPhysicsObjectExternalInterface::LockRead(Handle);
return Interface->GetV(Handle);
}
return FVector(0,0,0);
}
and this goes to in chaos vehicle to seems
FVector FReadPhysicsObjectInterface<Id>::GetV(const FConstPhysicsObjectHandle Object)
{
if (!Object)
{
return FVector::Zero();
}
if (TThreadParticle<Id>* Particle = Object->GetParticle<Id>())
{
if (Chaos::TThreadRigidParticle<Id>* Rigid = Particle->CastToRigidParticle())
{
return Rigid->GetV();
}
}
return FVector::Zero();
}
and seems this is on thread context sometimes if everything is right can return zero for chaos seems. Could be sleeping or not updated also as a guess only. Can you check the object state at that ticks?
I am also learning deeper about chaos so wanted to check.