Kactor, problem with scale and the "Invalid or Missing BodyInstance" error

I’m new with Kactors, I’m trying to spawn some, using code, and most of them have a drawscale of 0.5, but the collision works like the drawscale were 1.0.

This is the code, I’m using Kactorspawnable:



A = Spawn(class'KactorSpawnable',,, SomeLocation, SomeRotation,,false);

A.StaticmeshComponent.setstaticmesh(SomeStaticMesh);

A.CollisionComponent = A.P.StaticMeshComponent;

A.SetDrawScale(0.5);


I assing diferent staticmeshes from an array, so I can set them in the defaultproperties. I have tried setting Phys_none before the assignaments and Phys_rigidbody after, wakerigidbody, etc. With no result.

Also I have this error with all the actors, like this:

AActor::SyncActorToRBPhysics: Invalid or Missing BodyInstance in CollisionComponent. (check to make certain your object actually has a collision volume) for: KActorSpawnable tests.TheWorld:PersistentLevel.KActorSpawnable_21 CollisionComp: StaticMesh FoliageDemo.Mesh.S_ShanePlant_01 StaticMeshComponent_35 DetailedInfo: FoliageDemo.Mesh.S_ShanePlant_01

I have the same error with skeletalmeshes when goes out the ragdoll state with transition, never found a way to fix that.

How I can fix these two things?

(From the editor, converting these staticmeshactors to Kactors works with no problem, with drawscale 0.5 or others, and with no bodyinstance errors.)

I have solved partially the scale problem, by setting the drawscale before assign the staticmeshcomponent and the collision. But… when the Kactor is wake, “jump” to up, like the drawscale were 1.0. After that jump, it works fine with the 0.5 scale.
The same if I add wakerigidbody, the actors jumps up when are created, then fall to the floor.

And the bodyinstance error continues flooding the log.


A.CollisionComponent = A.P.StaticMeshComponent;

who is ‘P’ in this case, and why are you even re-assigning the collision component?

does your static mesh have a collision hull set up?

Was a mistake, sorry. In my code A is a struct, and P is the spawned Kactor. In the example must be A.CollisionComponent = A.StaticMeshComponent;

The static meshes are correct, they have collision, if I drop some in the map and convert it to Kactor, works fine. Perhaps Kactorspawnable needs some initialization after the spawn and mesh change, later I will look at the postbeginplay event.

I’ll also look it up later, but in any case you shouldn’t need to re-assign the CollisionComponent to be the StaticMeshComponent. in the defaultproperties it’s already the case so you’re wasting initialization time/processing by doing it :slight_smile:

True, also i found the problem with the log error, there was a mesh with no collision (the plant).

The only problem now is the “jump” when the scale is different to 1.0. I have tried with postbeginplay, setting the vars InitialLocation and InitialRotation, and runing Initialize(), but no result.

The only thing that is working is to modify the sourcer adding drawscale = 0.5 in the defaults, but this is not solution because not all the objects will have these scale. Must be something else that initialize the actor in somewhere.